summaryrefslogtreecommitdiffstats
path: root/tools/diag
diff options
context:
space:
mode:
authorphantom <phantom@FreeBSD.org>2002-02-04 16:17:19 +0000
committerphantom <phantom@FreeBSD.org>2002-02-04 16:17:19 +0000
commit742fd635ad2fe5c6a841ffa7ac3b546fe058e35f (patch)
treed2530d7f33a56d8969def4586b90ac1530d7f1f0 /tools/diag
parent4e3ec916920ba8e04c122b8cffc543e35cdc95dd (diff)
downloadFreeBSD-src-742fd635ad2fe5c6a841ffa7ac3b546fe058e35f.zip
FreeBSD-src-742fd635ad2fe5c6a841ffa7ac3b546fe058e35f.tar.gz
* fix some warnings
* set WARNS * few style/whitespace fixes Submitted by: ru
Diffstat (limited to 'tools/diag')
-rw-r--r--tools/diag/localeck/Makefile7
-rw-r--r--tools/diag/localeck/docheck.sh15
-rw-r--r--tools/diag/localeck/localeck.c15
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++;
}
}
OpenPOWER on IntegriCloud