diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1997-01-26 09:36:19 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1997-01-26 09:36:19 +0000 |
commit | 71c8e506523a54c4f474271f7968e8f8f6a70992 (patch) | |
tree | 83021d13b758290836adfef72356596dc7c749ef /gnu/usr.bin/cpio/dirname.c | |
parent | ec5c4ad7fb8cee450a178d9a1f479469e944fd41 (diff) |
cpio 2.4.2, including texinfo file. supports lchown().
Diffstat (limited to 'gnu/usr.bin/cpio/dirname.c')
-rw-r--r-- | gnu/usr.bin/cpio/dirname.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gnu/usr.bin/cpio/dirname.c b/gnu/usr.bin/cpio/dirname.c index 5a92ce557ff..15d25967afe 100644 --- a/gnu/usr.bin/cpio/dirname.c +++ b/gnu/usr.bin/cpio/dirname.c @@ -15,6 +15,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #ifdef STDC_HEADERS #include <stdlib.h> #else @@ -22,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, @@ -42,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. */ @@ -57,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); |