From: Jim Meyering Date: Fri, 27 Jan 1995 15:23:48 +0000 (+0000) Subject: (basename): Use strrchr, not rindex. X-Git-Tag: textutils-1_12_1~331 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=85bb215ab8496b9a293f6c37997087a6bad9d8c5;p=thirdparty%2Fcoreutils.git (basename): Use strrchr, not rindex. [!STDC_HEADERS && !HAVE_STRING_H]: Define strrchr to rindex. --- diff --git a/lib/basename.c b/lib/basename.c index b8e7e1f4f1..56a6c04dd0 100644 --- a/lib/basename.c +++ b/lib/basename.c @@ -15,11 +15,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#if defined(USG) || defined(STDC_HEADERS) +#ifdef HAVE_CONFIG_H +#include +#endif + +#if defined(STDC_HEADERS) || defined(HAVE_STRING_H) #include -#define rindex strrchr #else #include +#ifndef strrchr +#define strrchr rindex +#endif #endif /* Return NAME with any leading path stripped off. */ @@ -30,6 +36,6 @@ basename (name) { char *base; - base = rindex (name, '/'); + base = strrchr (name, '/'); return base ? base + 1 : name; }