aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-04-08 18:25:59 -0500
committerRob Landley <rob@landley.net>2016-04-08 18:25:59 -0500
commit1c028ca33dc059a9d8f18daafcd77b5950268f41 (patch)
treef1a6ac81fdecd28b72a864d20c5e65f18b302ee3 /lib/lib.c
parent9b93dd397b4a00063073fdbd59b181a508470e70 (diff)
downloadtoybox-1c028ca33dc059a9d8f18daafcd77b5950268f41.tar.gz
Redefining basename_r to mean something random seems popular (bionic and freebsd
both did it) so use getbasename instead.
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 3ca7052a..0380c13b 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -919,11 +919,14 @@ void mode_to_string(mode_t mode, char *buf)
*buf = c;
}
-char *basename_r(char *name)
+// basename() can modify its argument or return a pointer to a constant string
+// This just gives after the last '/' or the whole stirng if no /
+char *getbasename(char *name)
{
char *s = strrchr(name, '/');
if (s) return s+1;
+
return name;
}