summaryrefslogtreecommitdiff
path: root/usr.bin/basename
diff options
context:
space:
mode:
authorjtc <jtc@NetBSD.org>1993-10-01 22:41:28 +0000
committerjtc <jtc@NetBSD.org>1993-10-01 22:41:28 +0000
commit4bbb2333ff977dd671f80cd9c3380f28291cff26 (patch)
treeb7dd4971caf1c5c8e9ee940907ef41c701a6804d /usr.bin/basename
parent9acd4cced08a2d964fae627cabb95de9319b2c12 (diff)
Added setlocale(LC_ALL, "") --- all POSIX.2 utilities are supposed to
do this --- although this won't change the behavior of this utility until we have message catalogs implemented. Pass through FlexeLint.
Diffstat (limited to 'usr.bin/basename')
-rw-r--r--usr.bin/basename/basename.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/basename/basename.c b/usr.bin/basename/basename.c
index 1645dee75ef..13c692a5712 100644
--- a/usr.bin/basename/basename.c
+++ b/usr.bin/basename/basename.c
@@ -39,24 +39,26 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)basename.c 5.1 (Berkeley) 3/9/91";*/
-static char rcsid[] = "$Id: basename.c,v 1.3 1993/08/27 22:30:10 jtc Exp $";
+static char rcsid[] = "$Id: basename.c,v 1.4 1993/10/01 22:41:28 jtc Exp $";
#endif /* not lint */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <locale.h>
-static void usage();
+static void usage __P((void));
int
main(argc, argv)
int argc;
char **argv;
{
- extern int optind;
register char *p;
int ch;
+ setlocale(LC_ALL, "");
+
while ((ch = getopt(argc, argv, "")) != EOF)
switch(ch) {
case '?':
@@ -93,8 +95,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';
/*