1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Use Gnulib's `locale' module.

* configure.ac: Remove test for <xlocale.h>.

* libguile/i18n.c: Remove conditional <xlocale.h> inclusion on
  `HAVE_XLOCALE_H'.

* m4/gnulib-cache.m4: Add `locale' module.
This commit is contained in:
Ludovic Courtès 2009-11-23 22:50:34 +01:00
parent a270e133f3
commit 414e44412c
15 changed files with 249 additions and 19 deletions

1
.gitignore vendored
View file

@ -117,3 +117,4 @@ INSTALL
/GTAGS
/meta/guile-tools
/meta/guile-config
/lib/locale.h

View file

@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
if 0;
# Generate a release announcement message.
my $VERSION = '2009-10-30 15:59'; # UTC
my $VERSION = '2009-11-20 13:36'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
@ -442,6 +442,11 @@ EOF
my @sig_files = map { "$_.sig" } @tarballs;
print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
@sig_files);
if ($url_dir_list[0] =~ "gnu\.org")
{
print "To reduce load on the main server, use a mirror listed at:\n";
print " http://www.gnu.org/order/ftp.html\n\n";
}
$print_checksums_p
and print_checksums (@sizable);

View file

@ -730,13 +730,12 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime
# check this specifically, we need it for the timespec test below.
# sethostname - the function itself check because it's not in mingw,
# the DECL is checked because Solaris 10 doens't have in any header
# xlocale.h - needed on Darwin for the `locale_t' API
# hstrerror - on Tru64 5.1b the symbol is available in libc but the
# declaration isn't anywhere.
# cuserid - on Tru64 5.1b the declaration is documented to be available
# only with `_XOPEN_SOURCE' or some such.
#
AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h xlocale.h)
AC_CHECK_HEADERS([crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h])
AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
AC_CHECK_DECLS([sethostname, hstrerror, cuserid])

View file

@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write gendocs gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring maintainer-makefile putenv stdlib strcase strftime striconveh string verify version-etc-fsf vsnprintf warnings
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write gendocs gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile putenv stdlib strcase strftime striconveh string verify version-etc-fsf vsnprintf warnings
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
@ -497,6 +497,30 @@ EXTRA_DIST += config.charset ref-add.sin ref-del.sin
## end gnulib module localcharset
## begin gnulib module locale
BUILT_SOURCES += $(LOCALE_H)
# We need the following in order to create <locale.h> when the system
# doesn't have one that provides all definitions.
locale.h: locale.in.h
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
-e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \
-e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
-e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
< $(srcdir)/locale.in.h; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += locale.h locale.h-t
EXTRA_DIST += locale.in.h
## end gnulib module locale
## begin gnulib module lstat
@ -1279,6 +1303,7 @@ unistd.h: unistd.in.h
-e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
-e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \
-e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
-e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \
-e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
-e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
-e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
@ -1304,6 +1329,7 @@ unistd.h: unistd.in.h
-e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
-e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
-e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
-e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
-e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
-e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
-e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
@ -1323,9 +1349,11 @@ unistd.h: unistd.in.h
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
-e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
-e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
-e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
-e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \
-e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \
-e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
-e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
-e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \

58
lib/locale.in.h Normal file
View file

@ -0,0 +1,58 @@
/* A POSIX <locale.h>.
Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_LOCALE_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_LOCALE_H@
#ifndef _GL_LOCALE_H
#define _GL_LOCALE_H
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
/* MacOS X 10.5 defines the locale_t type in <xlocale.h>. */
#if @HAVE_XLOCALE_H@
# include <xlocale.h>
#endif
/* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
On systems that don't define it, use the same value as GNU libintl. */
#if !defined LC_MESSAGES
# define LC_MESSAGES 1729
#endif
#if @GNULIB_DUPLOCALE@
# if @REPLACE_DUPLOCALE@
# undef duplocale
# define duplocale rpl_duplocale
extern locale_t duplocale (locale_t locale);
# endif
#elif defined GNULIB_POSIXCHECK
# undef duplocale
# define duplocale(l) \
(GL_LINK_WARNING ("duplocale is buggy on some glibc systems - " \
"use gnulib module duplocale for portability"), \
duplocale (l))
#endif
#endif /* _GL_LOCALE_H */
#endif /* _GL_LOCALE_H */

View file

@ -714,11 +714,15 @@ extern int rmdir (char const *name);
#if @GNULIB_SLEEP@
# if @REPLACE_SLEEP@
# undef sleep
# define sleep rpl_sleep
# endif
/* Pause the execution of the current thread for N seconds.
Returns the number of seconds left to sleep.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/sleep.html>. */
# if !@HAVE_SLEEP@
# if !@HAVE_SLEEP@ || @REPLACE_SLEEP@
extern unsigned int sleep (unsigned int n);
# endif
#elif defined GNULIB_POSIXCHECK
@ -792,6 +796,27 @@ extern int unlinkat (int fd, char const *file, int flag);
#endif
#if @GNULIB_USLEEP@
# if @REPLACE_USLEEP@
# undef usleep
# define usleep rpl_usleep
# endif
# if !@HAVE_USLEEP@ || @REPLACE_USLEEP@
/* Pause the execution of the current thread for N microseconds.
Returns 0 on completion, or -1 on range error.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/sleep.html>. */
extern int usleep (useconds_t n);
# endif
#elif defined GNULIB_POSIXCHECK
# undef usleep
# define usleep(n) \
(GL_LINK_WARNING ("usleep is unportable - " \
"use gnulib module usleep for portability"), \
usleep (n))
#endif
#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
/* Write up to COUNT bytes starting at BUF to file descriptor FD.
See the POSIX:2001 specification

View file

@ -261,10 +261,10 @@ decimal_point_char (void)
{
const char *point;
/* Determine it in a multithread-safe way. We know nl_langinfo is
multithread-safe on glibc systems, but is not required to be multithread-
safe by POSIX. sprintf(), however, is multithread-safe. localeconv()
is rarely multithread-safe. */
# if HAVE_NL_LANGINFO && __GLIBC__
multithread-safe on glibc systems and MacOS X systems, but is not required
to be multithread-safe by POSIX. sprintf(), however, is multithread-safe.
localeconv() is rarely multithread-safe. */
# if HAVE_NL_LANGINFO && (__GLIBC__ || (defined __APPLE__ && defined __MACH__))
point = nl_langinfo (RADIXCHAR);
# elif 1
char pointbuf[5];

View file

@ -57,10 +57,6 @@
# define USE_GNU_LOCALE_API
#endif
#if (defined USE_GNU_LOCALE_API) && (defined HAVE_XLOCALE_H)
# include <xlocale.h>
#endif
#include "libguile/posix.h" /* for `scm_i_locale_mutex' */
#if (defined HAVE_LANGINFO_H) && (defined HAVE_NL_TYPES_H)

View file

@ -15,7 +15,7 @@
# Specification in the form of a command-line invocation:
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write gendocs gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring maintainer-makefile putenv stdlib strcase strftime striconveh string verify version-etc-fsf vsnprintf warnings
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild byteswap canonicalize-lgpl environ extensions flock fpieee full-read full-write gendocs gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions lib-symbol-visibility libunistring locale maintainer-makefile putenv stdlib strcase strftime striconveh string verify version-etc-fsf vsnprintf warnings
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
@ -43,6 +43,7 @@ gl_MODULES([
lib-symbol-versions
lib-symbol-visibility
libunistring
locale
maintainer-makefile
putenv
stdlib

View file

@ -90,6 +90,7 @@ AC_DEFUN([gl_INIT],
gl_LOCALCHARSET
LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(top_builddir)/$gl_source_base\""
AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
gl_LOCALE_H
gl_FUNC_LSTAT
gl_SYS_STAT_MODULE_INDICATOR([lstat])
gl_FUNC_MALLOC_POSIX
@ -328,6 +329,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/inet_pton.c
lib/localcharset.c
lib/localcharset.h
lib/locale.in.h
lib/lstat.c
lib/malloc.c
lib/malloca.c
@ -433,6 +435,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/locale-fr.m4
m4/locale-ja.m4
m4/locale-zh.m4
m4/locale_h.m4
m4/longlong.m4
m4/lstat.m4
m4/malloc.m4

View file

@ -1,5 +1,5 @@
# iconv_h.m4 serial 4
dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
# iconv_h.m4 serial 5
dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@ -7,6 +7,9 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_ICONV_H],
[
AC_REQUIRE([gl_ICONV_H_DEFAULTS])
dnl Execute this unconditionally, because ICONV_H may be set by other
dnl modules, after this code is executed.
gl_CHECK_NEXT_HEADERS([iconv.h])
])

82
m4/locale_h.m4 Normal file
View file

@ -0,0 +1,82 @@
# locale_h.m4 serial 5
dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_LOCALE_H],
[
dnl Use AC_REQUIRE here, so that the default behavior below is expanded
dnl once only, before all statements that occur in other macros.
AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
dnl Persuade glibc <locale.h> to define locale_t.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
dnl If <stddef.h> is replaced, then <locale.h> must also be replaced.
AC_REQUIRE([gl_STDDEF_H])
AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001],
[gl_cv_header_locale_h_posix2001],
[AC_TRY_COMPILE([#include <locale.h>
int x = LC_MESSAGES;], [],
[gl_cv_header_locale_h_posix2001=yes],
[gl_cv_header_locale_h_posix2001=no])])
dnl Check for <xlocale.h>.
AC_CHECK_HEADERS_ONCE([xlocale.h])
if test $ac_cv_header_xlocale_h = yes; then
HAVE_XLOCALE_H=1
dnl Check whether use of locale_t requires inclusion of <xlocale.h>,
dnl e.g. on MacOS X 10.5. If <locale.h> does not define locale_t by
dnl itself, we assume that <xlocale.h> will do so.
AC_CACHE_CHECK([whether locale.h defines locale_t],
[gl_cv_header_locale_has_locale_t],
[AC_TRY_COMPILE([#include <locale.h>
locale_t x;], [],
[gl_cv_header_locale_has_locale_t=yes],
[gl_cv_header_locale_has_locale_t=no])
])
if test $gl_cv_header_locale_has_locale_t = yes; then
gl_cv_header_locale_h_needs_xlocale_h=no
else
gl_cv_header_locale_h_needs_xlocale_h=yes
fi
else
HAVE_XLOCALE_H=0
gl_cv_header_locale_h_needs_xlocale_h=no
fi
AC_SUBST([HAVE_XLOCALE_H])
dnl Execute this unconditionally, because LOCALE_H may be set by other
dnl modules, after this code is executed.
gl_CHECK_NEXT_HEADERS([locale.h])
if test -n "$STDDEF_H" \
|| test $gl_cv_header_locale_h_posix2001 = no \
|| test $gl_cv_header_locale_h_needs_xlocale_h = yes; then
gl_REPLACE_LOCALE_H
fi
])
dnl Unconditionally enables the replacement of <locale.h>.
AC_DEFUN([gl_REPLACE_LOCALE_H],
[
AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
LOCALE_H=locale.h
])
AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
])
AC_DEFUN([gl_LOCALE_H_DEFAULTS],
[
GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE])
dnl Assume proper GNU behavior unless another module says otherwise.
REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE])
LOCALE_H=''; AC_SUBST([LOCALE_H])
])

View file

@ -1,4 +1,4 @@
# unistd_h.m4 serial 34
# unistd_h.m4 serial 36
dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -66,6 +66,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK])
GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT])
GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP])
GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN])
@ -96,6 +97,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT])
HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP])
REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE])
REPLACE_DUP=0; AC_SUBST([REPLACE_DUP])
@ -111,9 +113,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK])
REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR])
REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP])
REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK])
REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK])
REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT])
REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP])
REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE])
UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;

View file

@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Eric Blake.
# wchar.m4 serial 25
# wchar.m4 serial 26
AC_DEFUN([gl_WCHAR_H],
[
@ -45,6 +45,8 @@ wchar_t w;]],
HAVE_WCHAR_H=0
fi
AC_SUBST([HAVE_WCHAR_H])
dnl Execute this unconditionally, because WCHAR_H may be set by other
dnl modules, after this code is executed.
gl_CHECK_NEXT_HEADERS([wchar.h])
])

View file

@ -63,6 +63,20 @@ my_distdir = $(PACKAGE)-$(VERSION)
# Old releases are stored here.
release_archive_dir ?= ../release
# Override gnu_rel_host and url_dir_list in cfg.mk if these are not right.
# Use alpha.gnu.org for alpha and beta releases.
# Use ftp.gnu.org for stable releases.
gnu_ftp_host-alpha = alpha.gnu.org
gnu_ftp_host-beta = alpha.gnu.org
gnu_ftp_host-stable = ftp.gnu.org
gnu_rel_host ?= $(gnu_ftp_host-$(RELEASE_TYPE))
ifeq ($(gnu_rel_host),ftp.gnu.org)
url_dir_list ?= http://ftpmirror.gnu.org/$(PACKAGE)
else
url_dir_list ?= ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
endif
# Prevent programs like 'sort' from considering distinct strings to be equal.
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
export LC_ALL = C
@ -157,8 +171,17 @@ sc_prohibit_strcmp:
1>&2; exit 1; } || :
# Pass EXIT_*, not number, to usage, exit, and error (when exiting)
# Convert all uses automatically, via these two commands:
# git grep -l '\<exit *(1)' \
# | grep -vEf .x-sc_prohibit_magic_number_exit \
# | xargs --no-run-if-empty \
# perl -pi -e 's/(^|[^.])\b(exit ?)\(1\)/$1$2(EXIT_FAILURE)/'
# git grep -l '\<exit *(0)' \
# | grep -vEf .x-sc_prohibit_magic_number_exit \
# | xargs --no-run-if-empty \
# perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/'
sc_prohibit_magic_number_exit:
@re='\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,' \
@re='(^|[^.])\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,' \
msg='use EXIT_* values rather than magic number' \
$(_prohibit_regexp)