diff options
author | jozan <jozan@noemail.net> | 2020-11-15 18:25:10 +0000 |
---|---|---|
committer | jozan <jozan@noemail.net> | 2020-11-15 18:25:10 +0000 |
commit | 328a04717c4e3836070cb367850dd08d652c2399 (patch) | |
tree | 127e0122010b71acbc526741cd645a62ce08b1de /src/u_utils.c | |
parent | A directory is now a required argument, for safety (diff) | |
parent | no chdir, yeye (diff) | |
download | unixize-328a04717c4e3836070cb367850dd08d652c2399.tar.gz unixize-328a04717c4e3836070cb367850dd08d652c2399.tar.bz2 unixize-328a04717c4e3836070cb367850dd08d652c2399.tar.xz unixize-328a04717c4e3836070cb367850dd08d652c2399.tar.zst unixize-328a04717c4e3836070cb367850dd08d652c2399.zip |
Merging branch 'no-chdir' into branch 'trunk'
FossilOrigin-Name: 00312a77c3bb7f0db518892200595d9dab614ad584ef1573311159eabc4bec2b
Diffstat (limited to '')
-rw-r--r-- | src/u_utils.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/u_utils.c b/src/u_utils.c index 8555710..54b7916 100644 --- a/src/u_utils.c +++ b/src/u_utils.c @@ -210,37 +210,37 @@ u_get_nargv(struct opts_s* opts) } void -u_increase_subpath -(char subp[], +u_inc_path +(char path[], const char newp[]) { strlcpy( - subp + strlen(subp), + path + strlen(path), newp, - MAXPATHLEN - strlen(subp) - 1 + MAXPATHLEN - strlen(path) - 1 ); - subp[strlen(subp) + 1] = 0x00; - subp[strlen(subp)] = '/'; + path[strlen(path) + 1] = 0x00; + path[strlen(path)] = '/'; } void -u_decrease_subpath(char subp[]) +u_dec_path(char path[]) { char* p; - p = subp; - p += strlen(subp); + p = path; + p += strlen(path); if (p == 0) { return; } p -= 2; - while (subp - p != 0 && *p != '/') { + while (path - p != 0 && *p != '/') { p--; } if (*p == '/') { *(p + 1) = 0x00; } - else if (subp - p == 0) { + else if (path - p == 0) { *p = 0x00; } } |