* fix some warnings

* set WARNS
* few style/whitespace fixes

Submitted by:	ru
This commit is contained in:
phantom 2002-02-04 16:17:19 +00:00
parent 4e3ec91692
commit 742fd635ad
3 changed files with 18 additions and 19 deletions

View File

@ -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>

View File

@ -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"

View File

@ -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++;
}
}