| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | extern char *get_working_directory (char *); | - |
| 10 | | - |
| 11 | static char *nullpath = ""; | - |
| 12 | char * | - |
| 13 | sh_makepath (path, dir, flags) | - |
| 14 | const char *path, *dir; | - |
| 15 | int flags; | - |
| 16 | { | - |
| 17 | int dirlen, pathlen; | - |
| 18 | char *ret, *xpath, *xdir, *r, *s; | - |
| 19 | | - |
| 20 | if (path == 0| TRUE | never evaluated | | FALSE | evaluated 31544 times by 1 test |
|| *| TRUE | never evaluated | | FALSE | evaluated 31544 times by 1 test |
path == '\0'| TRUE | never evaluated | | FALSE | evaluated 31544 times by 1 test |
) | 0-31544 |
| 21 | { | - |
| 22 | if (flags & 0x02| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 23 | { | - |
| 24 | xpath = get_working_directory ("sh_makepath"); | - |
| 25 | if (xpath == 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 26 | { | - |
| 27 | ret = get_string_value ("PWD"); | - |
| 28 | if (ret| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 29 | xpath = (char *)strcpy (sh_xmalloc((1 + strlen (ret)), "makepath.c", 86), (ret)); never executed: xpath = (char *)strcpy (sh_xmalloc((1 + strlen (ret)), "makepath.c", 86), (ret)); | 0 |
| 30 | } never executed: end of block | 0 |
| 31 | if (xpath == 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 32 | do { xpath = (char *)sh_xmalloc((2), "makepath.c", 89); xpath[0] = '.'; xpath[1] = '\0'; pathlen = 1; } never executed: end of block while (0); | 0 |
| 33 | else | - |
| 34 | pathlen = strlen (xpath); never executed: pathlen = strlen (xpath); | 0 |
| 35 | } | - |
| 36 | else | - |
| 37 | do { xpath = (char *)sh_xmalloc((2), "makepath.c", 94); xpath[0] = '.'; xpath[1] = '\0'; pathlen = 1; } never executed: end of block while (0); | 0 |
| 38 | } | - |
| 39 | else if ((| TRUE | evaluated 579 times by 1 test | | FALSE | evaluated 30965 times by 1 test |
flags & 0x08)| TRUE | evaluated 579 times by 1 test | | FALSE | evaluated 30965 times by 1 test |
&& path[0] == '.'| TRUE | evaluated 94 times by 1 test | | FALSE | evaluated 485 times by 1 test |
&& (path[1] == '\0'| TRUE | evaluated 94 times by 1 test | | FALSE | never evaluated |
|| | 0-30965 |
| 40 | (path[1] == '/'| TRUE | never evaluated | | FALSE | never evaluated |
&& path[2] == '\0'| TRUE | never evaluated | | FALSE | never evaluated |
))) | 0 |
| 41 | { | - |
| 42 | xpath = nullpath; | - |
| 43 | pathlen = 0; | - |
| 44 | }executed 94 times by 1 test: end of block | 94 |
| 45 | else | - |
| 46 | { | - |
| 47 | xpath = ((| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 31448 times by 1 test |
flags & 0x01)| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 31448 times by 1 test |
&& *| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
path == '~'| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
) ? bash_tilde_expand (path, 0) : (char *)path; | 0-31448 |
| 48 | pathlen = strlen (xpath); | - |
| 49 | }executed 31450 times by 1 test: end of block | 31450 |
| 50 | | - |
| 51 | xdir = (char *)dir; | - |
| 52 | dirlen = strlen (xdir); | - |
| 53 | if ((| TRUE | evaluated 817 times by 1 test | | FALSE | evaluated 30727 times by 1 test |
flags & 0x04)| TRUE | evaluated 817 times by 1 test | | FALSE | evaluated 30727 times by 1 test |
&& dir[0] == '.'| TRUE | never evaluated | | FALSE | evaluated 817 times by 1 test |
&& dir[1] == '/'| TRUE | never evaluated | | FALSE | never evaluated |
) | 0-30727 |
| 54 | { | - |
| 55 | xdir += 2; | - |
| 56 | dirlen -= 2; | - |
| 57 | } never executed: end of block | 0 |
| 58 | | - |
| 59 | r = ret = (char *)sh_xmalloc((2 + dirlen + pathlen), "makepath.c", 116); | - |
| 60 | s = xpath; | - |
| 61 | while (*| TRUE | evaluated 502903 times by 1 test | | FALSE | evaluated 31544 times by 1 test |
s| TRUE | evaluated 502903 times by 1 test | | FALSE | evaluated 31544 times by 1 test |
) | 31544-502903 |
| 62 | *executed 502903 times by 1 test: *r++ = *s++; r++ = *s++;executed 502903 times by 1 test: *r++ = *s++; | 502903 |
| 63 | if (s > xpath| TRUE | evaluated 31450 times by 1 test | | FALSE | evaluated 94 times by 1 test |
&& s[-1] != '/'| TRUE | evaluated 31442 times by 1 test | | FALSE | evaluated 8 times by 1 test |
) | 8-31450 |
| 64 | *executed 31442 times by 1 test: *r++ = '/'; r++ = '/';executed 31442 times by 1 test: *r++ = '/'; | 31442 |
| 65 | s = xdir; | - |
| 66 | while (*| TRUE | evaluated 91049 times by 1 test | | FALSE | evaluated 31544 times by 1 test |
r++ = *s++| TRUE | evaluated 91049 times by 1 test | | FALSE | evaluated 31544 times by 1 test |
) | 31544-91049 |
| 67 | ;executed 91049 times by 1 test: ; | 91049 |
| 68 | if (xpath != path| TRUE | evaluated 94 times by 1 test | | FALSE | evaluated 31450 times by 1 test |
&& xpath != nullpath| TRUE | never evaluated | | FALSE | evaluated 94 times by 1 test |
) | 0-31450 |
| 69 | sh_xfree((xpath), "makepath.c", 126); never executed: sh_xfree((xpath), "makepath.c", 126); | 0 |
| 70 | returnexecuted 31544 times by 1 test: return (ret); (ret);executed 31544 times by 1 test: return (ret); | 31544 |
| 71 | } | - |
| | |