From: Ralph Corderoy Date: Mon, 11 Sep 2017 17:23:33 +0000 (+0100) Subject: path.c: Re-format path() to make it more clear what's happening. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/a37e496eeca84e0ea3fc1c7a95b013541a443cee?ds=sidebyside;hp=14e7f92ac37c70e4267e8602a036aa4e08a09447 path.c: Re-format path() to make it more clear what's happening. --- diff --git a/sbr/path.c b/sbr/path.c index bf9283a3..28d0e773 100644 --- a/sbr/path.c +++ b/sbr/path.c @@ -31,14 +31,17 @@ pluspath(char *name) char * path(char *name, int flag) { - char *cp, *ep; + char *p, *last; + + p = expath(name, flag); + if (!p) + return NULL; - if ((cp = expath (name, flag)) - && (ep = cp + strlen (cp) - 1) > cp - && *ep == '/') - *ep = '\0'; + last = p + strlen(p) - 1; + if (last > p && *last == '/') + *last = '\0'; - return cp; + return p; }