summaryrefslogtreecommitdiff
path: root/lib/dirname.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-10-20 16:16:54 +0000
committerJim Meyering <jim@meyering.net>1994-10-20 16:16:54 +0000
commit2516905b58eead5c5285af06e09d350343b9f5fb (patch)
treee9fe7680856402e8f919f8bbe24ac77a2744aa06 /lib/dirname.c
parent94f5c09e0fa745b51d1b91f7bd7fc70ddf33b708 (diff)
downloadgnulib-2516905b58eead5c5285af06e09d350343b9f5fb.tar.gz
merge with 3.9p
Diffstat (limited to 'lib/dirname.c')
-rw-r--r--lib/dirname.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/dirname.c b/lib/dirname.c
index 9290614805..15d25967af 100644
--- a/lib/dirname.c
+++ b/lib/dirname.c
@@ -26,11 +26,11 @@ char *malloc ();
#endif
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
#include <string.h>
-#ifndef rindex
-#define rindex strrchr
-#endif
#else
#include <strings.h>
+#ifndef strrchr
+#define strrchr rindex
+#endif
#endif
/* Return the leading directories part of PATH,
@@ -46,7 +46,7 @@ dirname (path)
char *slash;
int length; /* Length of result, not including NUL. */
- slash = rindex (path, '/');
+ slash = strrchr (path, '/');
if (slash == 0)
{
/* File is in the current directory. */
@@ -61,7 +61,7 @@ dirname (path)
length = slash - path + 1;
}
- newpath = malloc (length + 1);
+ newpath = (char *) malloc (length + 1);
if (newpath == 0)
return 0;
strncpy (newpath, path, length);