Differences between current version and previous revision of basename(3).
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 2 | Last edited on Sunday, July 7, 2002 3:59:56 pm | by !PerryLorier | |
Older page: | version 1 | Last edited on Sunday, July 7, 2002 3:59:56 pm | by PerryLorier | Revert |
@@ -87,13 +87,13 @@
dirname(1), basename(1),
----
-PerryLorier:
+!
PerryLorier:
I after reading this man page you're probably as paranoid about this function as I am. Here is an efficient and reliable implementation:
char *mybasename(char *x)
{
if (!x)
return x;
return strrchr(x) ? strrchr(x)+1 : x;
}
if this is listed as being static then the compiler should do a nice job of optimising this.