summaryrefslogtreecommitdiff
path: root/lib/hard-locale.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-08-02 22:48:49 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-08-02 22:48:49 +0000
commitecb7230885520949f6d6c7b3afc96b39c13802e3 (patch)
tree5036f40c5b7c5ac01876991ea766636570080b57 /lib/hard-locale.c
parent21e7da65ea7e31bc69313e6d7bd7a9491f18774e (diff)
downloadcoreutils-ecb7230885520949f6d6c7b3afc96b39c13802e3.tar.xz
hard-locale.c (hard_locale): Return bool, not int.
Diffstat (limited to 'lib/hard-locale.c')
-rw-r--r--lib/hard-locale.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/hard-locale.c b/lib/hard-locale.c
index 8c0ee8c77..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, 2003 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
@@ -29,23 +30,23 @@
#include <stdlib.h>
#include <string.h>
-/* 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)
@@ -59,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);