]> diplodocus.org Git - nmh/commitdiff
path.c: Re-format path() to make it more clear what's happening.
authorRalph Corderoy <ralph@inputplus.co.uk>
Mon, 11 Sep 2017 17:23:33 +0000 (18:23 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Mon, 11 Sep 2017 17:23:33 +0000 (18:23 +0100)
sbr/path.c

index bf9283a30437bf4464b75f0dcae48e930a76a063..28d0e7735d6485fd30d87e95d181147e0ff6e21f 100644 (file)
@@ -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;
 }