X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/fbbc1d8078ecaf1cbfbade84cf54913ad4409220..9acf7ea2c5f9e428d3791f224b54f2e757ace36b:/test/getcwidth.c diff --git a/test/getcwidth.c b/test/getcwidth.c index 9e1ba65c..c1717e17 100644 --- a/test/getcwidth.c +++ b/test/getcwidth.c @@ -30,13 +30,18 @@ int main(int argc, char *argv[]) { #ifndef MULTIBYTE_SUPPORT + (void) argc; + (void) argv; fprintf(stderr, "Nmh was not configured with multibyte support\n"); exit(1); #else /* MULTIBYTE_SUPPORT */ wchar_t c; int i; - setlocale(LC_ALL, ""); + if (! setlocale(LC_ALL, "")) { + fprintf(stderr, "setlocale failed, check your LC_ALL, " + "LC_CTYPE, and LANG environment variables\n"); + } if (argc < 2) usage(argv[0]); @@ -109,7 +114,7 @@ getwidth(const char *string) * at a time. */ - mbtowc(NULL, NULL, 0); + if (mbtowc(NULL, NULL, 0)) {} while (charleft > 0) { int clen; @@ -159,5 +164,5 @@ dumpwidth(void) if (width == lastwidth) printf("%04lX - %04lX = %d\n", (unsigned long int) low, (unsigned long int) (wc), width); -} #endif /* MULTIBYTE_SUPPORT */ +}