X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fhard-locale.c;h=67a4144a6fec74d12a3addac772c0eb20c2c70e7;hb=ef0976ff2bb852d7d4016ce0b1d2afc0594ffe19;hp=0070542e09fac2893b0ed5f2f9ac26f3e5b67861;hpb=9e38fe502809e8eb64141d9e9f1b2542ba681600;p=gnulib.git diff --git a/lib/hard-locale.c b/lib/hard-locale.c index 0070542e0..67a4144a6 100644 --- a/lib/hard-locale.c +++ b/lib/hard-locale.c @@ -1,6 +1,7 @@ /* hard-locale.c -- Determine whether a locale is hard. - Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2002, 2003, 2004 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,37 +21,32 @@ # include #endif +#include "hard-locale.h" + #if HAVE_LOCALE_H # include #endif -#if HAVE_STDLIB_H -# include -#endif - -#if HAVE_STRING_H -# include -#endif - -#include "hard-locale.h" +#include +#include -/* Return nonzero if the current CATEGORY locale is hard, i.e. if you +/* Return true if the current CATEGORY locale is hard, i.e. if you can't get away with assuming traditional C or POSIX behavior. */ -int +bool hard_locale (int category) { #if ! HAVE_SETLOCALE - return 0; + return false; #else - int hard = 1; - char const *p = setlocale (category, 0); + bool hard = true; + char const *p = setlocale (category, NULL); if (p) { # if defined __GLIBC__ && 2 <= __GLIBC__ if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0) - hard = 0; + hard = false; # else char *locale = malloc (strlen (p) + 1); if (locale) @@ -64,7 +60,7 @@ hard_locale (int category) && strcmp (p, locale) == 0) || ((p = setlocale (category, "POSIX")) && strcmp (p, locale) == 0)) - hard = 0; + hard = false; /* Restore the caller's locale. */ setlocale (category, locale);