From f90427b5d2710bacdce2e81ef235db4b146edecc Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 19 Apr 2017 09:56:33 +0200 Subject: libgen: implement posix_basename There are two different versions of basename(): The GNU version and the POSIX version. The GNU version never modifies its argument and returns the empty string when path has a trailing slash, and in particular also when it is "/". The POSIX version modifies its argument and thus works properly with strings which have a trailing "/". Signed-off-by: Sascha Hauer --- include/libgen.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/libgen.h b/include/libgen.h index cd27fd11e3..71f06eb6f6 100644 --- a/include/libgen.h +++ b/include/libgen.h @@ -2,6 +2,7 @@ #define __LIBGEN_H char *basename (char *path); +char *posix_basename(char *path); char *dirname (char *path); #endif /* __LIBGEN_H */ -- cgit v1.2.3