| 30 | my_path puts result in to and returns to */ |
| 31 | |
| 32 | char * my_path(char * to, const char *progname, |
| 33 | const char *own_pathname_part) |
| 34 | { |
| 35 | char *start, *end, *prog; |
| 36 | size_t to_length; |
| 37 | DBUG_ENTER("my_path"); |
| 38 | |
| 39 | start=to; /* Return this */ |
| 40 | if (progname && (dirname_part(to, progname, &to_length) || |
| 41 | find_file_in_path(to,progname) || |
| 42 | ((prog=getenv("_")) != 0 && |
| 43 | dirname_part(to, prog, &to_length)))) |
| 44 | { |
| 45 | (void) intern_filename(to,to); |
| 46 | if (!test_if_hard_path(to)) |
| 47 | { |
| 48 | if (!my_getwd(curr_dir,FN_REFLEN,MYF(0))) |
| 49 | bchange((uchar*) to, 0, (uchar*) curr_dir, strlen(curr_dir), strlen(to)+1); |
| 50 | } |
| 51 | } |
| 52 | else |
| 53 | { |
| 54 | if ((end = getenv("MY_BASEDIR_VERSION")) == 0 && |
| 55 | (end = getenv("MY_BASEDIR")) == 0) |
| 56 | { |
| 57 | #ifdef DEFAULT_BASEDIR |
| 58 | end= (char*) DEFAULT_BASEDIR; |
| 59 | #else |
| 60 | end= (char*) "/my/"; |
| 61 | #endif |
| 62 | } |
| 63 | (void) intern_filename(to,end); |
| 64 | to=strend(to); |
| 65 | if (to != start && to[-1] != FN_LIBCHAR) |
| 66 | *to++ = FN_LIBCHAR; |
| 67 | (void) strmov(to,own_pathname_part); |
| 68 | } |
| 69 | DBUG_PRINT("exit",("to: '%s'",start)); |
| 70 | DBUG_RETURN(start); |
| 71 | } /* my_path */ |
| 72 | |
| 73 | |
| 74 | /* test if file without filename is found in path */ |
nothing calls this directly
no test coverage detected