diff options
-rw-r--r-- | tools/diag/localeck/Makefile | 7 | ||||
-rw-r--r-- | tools/diag/localeck/docheck.sh | 15 | ||||
-rw-r--r-- | tools/diag/localeck/localeck.c | 15 |
3 files changed, 18 insertions, 19 deletions
diff --git a/tools/diag/localeck/Makefile b/tools/diag/localeck/Makefile index 3505a0b..b6c145a 100644 --- a/tools/diag/localeck/Makefile +++ b/tools/diag/localeck/Makefile @@ -1,11 +1,12 @@ # $FreeBSD$ PROG= localeck -NOMAN= YES +NOMAN= noman +WARNS?= 4 -LOCALEDIR?=/usr/share/locale +LOCALEDIR?= /usr/share/locale test: ${PROG} - /bin/sh docheck.sh ${LOCALEDIR} + sh docheck.sh ${LOCALEDIR} .include <bsd.prog.mk> diff --git a/tools/diag/localeck/docheck.sh b/tools/diag/localeck/docheck.sh index d9abc7a..7f47851 100644 --- a/tools/diag/localeck/docheck.sh +++ b/tools/diag/localeck/docheck.sh @@ -21,20 +21,17 @@ PATH_LOCALE=$LOCALEDIR LOCALES=0 ERRORS=0 -echo "Validating locales in $LOCALEDIR" +echo "Validating locales in $LOCALEDIR" echo for i in `ls -1 $LOCALEDIR` do - LOCALES=`expr $LOCALES + 1` - ./localeck $i - if [ $? != 0 ]; then - ERRORS=`expr $ERRORS + 1` - fi + LOCALES=$(($LOCALES + 1)) + ./localeck $i || ERRORS=$(($ERRORS + 1)) done echo -echo "Validation test complete." -echo "$LOCALES locale(s) were checked" -echo "$ERRORS invalid locale(s) were found" +echo "Validation test complete" +echo "$LOCALES locales were checked" +echo "$ERRORS invalid locales were found" diff --git a/tools/diag/localeck/localeck.c b/tools/diag/localeck/localeck.c index d960554..43a816f 100644 --- a/tools/diag/localeck/localeck.c +++ b/tools/diag/localeck/localeck.c @@ -28,14 +28,15 @@ #include <locale.h> #include <stdio.h> +#include <stdlib.h> /* - * Try setlocale() for locale with given name + * Try setlocale() for locale with given name. */ struct locdef { - int catid; - char *catname; + int catid; + const char *catname; } locales[_LC_LAST] = { { LC_ALL, "LC_ALL" }, { LC_COLLATE, "LC_COLLATE" }, @@ -49,11 +50,11 @@ struct locdef { int main(int argc, char **argv) { - int i, result; - char *localename; + int i, result; + const char *localename; if (argc != 2) { - fprintf(stderr, "Usage: localeck <locale_name>\n"); + (void)fprintf(stderr, "Usage: localeck <locale_name>\n"); exit(1); } @@ -63,7 +64,7 @@ main(int argc, char **argv) { for (i = 0; i < _LC_LAST; i++) { if (setlocale(locales[i].catid, localename) == NULL) { printf("setlocale(%s, %s) failed\n", locales[i].catname, - localename); + localename); result++; } } |