diff options
Diffstat (limited to 'usr.bin/dirname')
| -rw-r--r-- | usr.bin/dirname/Makefile | 3 | ||||
| -rw-r--r-- | usr.bin/dirname/dirname.c | 19 |
2 files changed, 16 insertions, 6 deletions
diff --git a/usr.bin/dirname/Makefile b/usr.bin/dirname/Makefile index 446ed1a4344a..402481741c51 100644 --- a/usr.bin/dirname/Makefile +++ b/usr.bin/dirname/Makefile @@ -1,4 +1,5 @@ -# @(#)Makefile 5.2 (Berkeley) 5/11/90 +# from: @(#)Makefile 5.2 (Berkeley) 5/11/90 +# $Id: Makefile,v 1.2 1993/11/23 00:01:34 jtc Exp $ PROG= dirname NOMAN= noman diff --git a/usr.bin/dirname/dirname.c b/usr.bin/dirname/dirname.c index 662cd5bfb42c..8a37986cd18a 100644 --- a/usr.bin/dirname/dirname.c +++ b/usr.bin/dirname/dirname.c @@ -38,21 +38,27 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)dirname.c 5.6 (Berkeley) 3/9/91"; +/*static char sccsid[] = "from: @(#)dirname.c 5.6 (Berkeley) 3/9/91";*/ +static char rcsid[] = "$Id: dirname.c,v 1.2 1993/11/23 00:01:35 jtc Exp $"; #endif /* not lint */ #include <stdio.h> #include <stdlib.h> +#include <locale.h> +static void usage __P((void)); + +int main(argc, argv) int argc; char **argv; { - extern int optind; register char *p; int ch; - while ((ch = getopt(argc, argv, "")) != EOF) + setlocale(LC_ALL, ""); + + while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { case '?': default: @@ -86,8 +92,10 @@ main(argc, argv) * (3) If there are any trailing slash characters in string, they * shall be removed. */ - for (; *p; ++p); - while (*--p == '/'); + for (; *p; ++p) + ; + while (*--p == '/') + ; *++p = '\0'; /* @@ -132,6 +140,7 @@ main(argc, argv) exit(0); } +static void usage() { (void)fprintf(stderr, "usage: dirname path\n"); |
