diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-15 10:47:50 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-15 10:47:50 -0300 |
commit | 711c318c072f6d5fd5c2877ccc736c7673d1711d (patch) | |
tree | ac8b15ac65b08a492c256369b73e372f6568c7a4 /mysys/mf_pack.c | |
parent | 00538253b592522babe3609af29cb3eb87218b64 (diff) | |
parent | fd64a0db45705ca5eb2ad34ffc2ed1d9ef961017 (diff) | |
download | mariadb-git-711c318c072f6d5fd5c2877ccc736c7673d1711d.tar.gz |
Merge of mysql-trunk-bugfixing into mysql-trunk-merge.
Diffstat (limited to 'mysys/mf_pack.c')
-rw-r--r-- | mysys/mf_pack.c | 79 |
1 files changed, 5 insertions, 74 deletions
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index 86fd61537e7..c6e6a3a429e 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -18,13 +18,8 @@ #ifdef HAVE_PWD_H #include <pwd.h> #endif -#ifdef VMS -#include <rms.h> -#include <iodef.h> -#include <descrip.h> -#endif /* VMS */ -static char * NEAR_F expand_tilde(char * *path); +static char * expand_tilde(char **path); /* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */ /* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */ @@ -300,8 +295,7 @@ size_t normalize_dirname(char *to, const char *from) /* Despite the name, this actually converts the name to the system's - format (TODO: rip out the non-working VMS stuff and name this - properly). + format (TODO: name this properly). */ (void) intern_filename(buff, from); length= strlen(buff); /* Fix that '/' is last */ @@ -377,7 +371,7 @@ size_t unpack_dirname(char * to, const char *from) /* Expand tilde to home or user-directory */ /* Path is reset to point at FN_LIBCHAR after ~xxx */ -static char * NEAR_F expand_tilde(char * *path) +static char * expand_tilde(char **path) { if (path[0][0] == FN_LIBCHAR) return home_dir; /* ~/ expanded to home */ @@ -443,73 +437,10 @@ size_t unpack_filename(char * to, const char *from) /* Used before system command's like open(), create() .. */ /* Returns used length of to; total length should be FN_REFLEN */ -size_t system_filename(char * to, const char *from) +size_t system_filename(char *to, const char *from) { -#ifndef FN_C_BEFORE_DIR return (size_t) (strmake(to,from,FN_REFLEN-1)-to); -#else /* VMS */ - - /* change 'dev:lib/xxx' to 'dev:[lib]xxx' */ - /* change 'dev:xxx' to 'dev:xxx' */ - /* change './xxx' to 'xxx' */ - /* change './lib/' or lib/ to '[.lib]' */ - /* change '/x/y/z to '[x.y]x' */ - /* change 'dev:/x' to 'dev:[000000]x' */ - - int libchar_found; - size_t length; - char * to_pos,from_pos,pos; - char buff[FN_REFLEN]; - DBUG_ENTER("system_filename"); - - libchar_found=0; - (void) strmov(buff,from); /* If to == from */ - from_pos= buff; - if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */ - { - pos++; - to_pos=strnmov(to,from_pos,(size_t) (pos-from_pos)); - from_pos=pos; - } - else - to_pos=to; - - if (from_pos[0] == FN_CURLIB && from_pos[1] == FN_LIBCHAR) - from_pos+=2; /* Skip './' */ - if (strchr(from_pos,FN_LIBCHAR)) - { - *(to_pos++) = FN_C_BEFORE_DIR; - if (strinstr(from_pos,FN_ROOTDIR) == 1) - { - from_pos+=strlen(FN_ROOTDIR); /* Actually +1 but... */ - if (! strchr(from_pos,FN_LIBCHAR)) - { /* No dir, use [000000] */ - to_pos=strmov(to_pos,FN_C_ROOT_DIR); - libchar_found++; - } - } - else - *(to_pos++)=FN_C_DIR_SEP; /* '.' gives current dir */ - - while ((pos=strchr(from_pos,FN_LIBCHAR))) - { - if (libchar_found++) - *(to_pos++)=FN_C_DIR_SEP; /* Add '.' between dirs */ - if (strinstr(from_pos,FN_PARENTDIR) == 1 && - from_pos+strlen(FN_PARENTDIR) == pos) - to_pos=strmov(to_pos,FN_C_PARENT_DIR); /* Found '../' */ - else - to_pos=strnmov(to_pos,from_pos,(size_t) (pos-from_pos)); - from_pos=pos+1; - } - *(to_pos++)=FN_C_AFTER_DIR; - } - length= (size_t) (strmov(to_pos,from_pos)-to); - DBUG_PRINT("exit",("name: '%s'",to)); - DBUG_RETURN(length); -#endif -} /* system_filename */ - +} /* Fix a filename to intern (UNIX format) */ |