From afcf05e46aacbe58f9fd8338ab6ecf9b7d06d004 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Fri, 2 Mar 2001 16:52:14 +0000 Subject: [PATCH] setlocale(3) has been fixed to match POSIX standard: LC_ALL takes precedence over other LC_* envariables. --- Makefile | 4 ++-- Makefile.inc1 | 4 ++-- contrib/groff/eqn/neqn.sh | 2 +- contrib/groff/mdate.sh | 2 +- contrib/groff/src/preproc/eqn/neqn.sh | 2 +- contrib/sendmail/cf/sh/makeinfo.sh | 2 +- etc/periodic/weekly/320.whatis | 2 +- etc/periodic/weekly/330.catman | 2 +- games/morse/morse.6 | 2 +- games/morse/morse.c | 6 +++--- gnu/usr.bin/man/catman/catman.perl | 10 ++-------- gnu/usr.bin/man/makewhatis/makewhatis.perl | 10 ++-------- gnu/usr.bin/man/man/man.man | 4 ++-- gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh | 2 +- release/Makefile | 4 ++-- secure/lib/libcrypto/Makefile.inc | 2 +- sys/boot/common/newvers.sh | 2 +- sys/boot/ficl/Makefile | 2 +- sys/conf/newvers.sh | 2 +- usr.sbin/kbdmap/kbdmap.pl | 2 +- usr.sbin/named/Makefile.inc | 2 +- usr.sbin/ntp/scripts/mkver | 2 +- 22 files changed, 30 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 52e6c62760e1..d373f6f837b5 100644 --- a/Makefile +++ b/Makefile @@ -103,7 +103,7 @@ ${TGTS}: upgrade_checks # Set a reasonable default .MAIN: all -STARTTIME!= LC_TIME=C date +STARTTIME!= LC_ALL=C date # # world # @@ -132,7 +132,7 @@ world: upgrade_checks .endif @echo @echo "--------------------------------------------------------------" - @printf ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`\n (started ${STARTTIME})\n" + @printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" @echo "--------------------------------------------------------------" # diff --git a/Makefile.inc1 b/Makefile.inc1 index 0ddc083db28e..39cc7fccf588 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -408,7 +408,7 @@ buildkernel: @echo .for _kernel in ${BUILDKERNELS} @echo "--------------------------------------------------------------" - @echo ">>> Kernel build for ${_kernel} started on `LC_TIME=C date`" + @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" @echo "--------------------------------------------------------------" @echo "===> ${_kernel}" mkdir -p ${KRNLOBJDIR} @@ -431,7 +431,7 @@ buildkernel: cd ${KRNLOBJDIR}/${_kernel}; \ ${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} all @echo "--------------------------------------------------------------" - @echo ">>> Kernel build for ${_kernel} completed on `LC_TIME=C date`" + @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" @echo "--------------------------------------------------------------" .endfor diff --git a/contrib/groff/eqn/neqn.sh b/contrib/groff/eqn/neqn.sh index 1ae98e8fa8b8..49cd70f3e1d4 100644 --- a/contrib/groff/eqn/neqn.sh +++ b/contrib/groff/eqn/neqn.sh @@ -4,7 +4,7 @@ # $FreeBSD$ # Default device. -locale=${LC_CTYPE:-$LANG} +locale=${LC_ALL:-${LC_CTYPE:-$LANG}} if test `expr "$locale" : ".*\.ISO_8859-1"` -gt 0 then T=latin1 diff --git a/contrib/groff/mdate.sh b/contrib/groff/mdate.sh index b07346ab886e..4d50168ae87f 100755 --- a/contrib/groff/mdate.sh +++ b/contrib/groff/mdate.sh @@ -7,7 +7,7 @@ # Don't want foreign dates. LANGUAGE= -LC_TIME=C; export LC_TIME +LC_ALL=C; export LC_ALL (date; diff --git a/contrib/groff/src/preproc/eqn/neqn.sh b/contrib/groff/src/preproc/eqn/neqn.sh index 1ae98e8fa8b8..49cd70f3e1d4 100644 --- a/contrib/groff/src/preproc/eqn/neqn.sh +++ b/contrib/groff/src/preproc/eqn/neqn.sh @@ -4,7 +4,7 @@ # $FreeBSD$ # Default device. -locale=${LC_CTYPE:-$LANG} +locale=${LC_ALL:-${LC_CTYPE:-$LANG}} if test `expr "$locale" : ".*\.ISO_8859-1"` -gt 0 then T=latin1 diff --git a/contrib/sendmail/cf/sh/makeinfo.sh b/contrib/sendmail/cf/sh/makeinfo.sh index 8fb371c2c66e..e7b0cd101fce 100644 --- a/contrib/sendmail/cf/sh/makeinfo.sh +++ b/contrib/sendmail/cf/sh/makeinfo.sh @@ -54,7 +54,7 @@ then else host=`uname -n` fi -echo '#####' built by $user@$host on `LC_TIME=C date` +echo '#####' built by $user@$host on `LC_ALL=C LC_TIME=C date` echo '#####' in `pwd` | sed 's/\/tmp_mnt//' echo '#####' using $1 as configuration include directory | sed 's/\/tmp_mnt//' echo "define(\`__HOST__', $host)dnl" diff --git a/etc/periodic/weekly/320.whatis b/etc/periodic/weekly/320.whatis index 6af77477a22c..dfc218ae008c 100755 --- a/etc/periodic/weekly/320.whatis +++ b/etc/periodic/weekly/320.whatis @@ -36,7 +36,7 @@ case "$weekly_whatis_enable" in then for i in ${man_locales} do - LC_CTYPE=$i /usr/libexec/makewhatis.local -a \ + LC_ALL=$i /usr/libexec/makewhatis.local -a \ -L "${MANPATH}" || rc=3 done fi diff --git a/etc/periodic/weekly/330.catman b/etc/periodic/weekly/330.catman index 999913fb7025..6739ae9fec1a 100755 --- a/etc/periodic/weekly/330.catman +++ b/etc/periodic/weekly/330.catman @@ -42,7 +42,7 @@ case "$weekly_catman_enable" in then for i in $man_locales do - LC_CTYPE=$i echo /usr/libexec/catman.local -L \ + LC_ALL=$i echo /usr/libexec/catman.local -L \ "$MANPATH" | su -fm man || rc=3 done fi diff --git a/games/morse/morse.6 b/games/morse/morse.6 index 42db42aa02dd..6b7f70835f35 100644 --- a/games/morse/morse.6 +++ b/games/morse/morse.6 @@ -138,8 +138,8 @@ speaker device file .El .Sh ENVIRONMENT .Bl -tag -width LC_CTYPE -compact -.It Ev LC_CTYPE .It Ev LC_ALL +.It Ev LC_CTYPE .It Ev LANG If one of these variables (in this priority) is set to a locale ending in .Ql KOI8-R , diff --git a/games/morse/morse.c b/games/morse/morse.c index 38293a73702e..6579e8dd020c 100644 --- a/games/morse/morse.c +++ b/games/morse/morse.c @@ -318,9 +318,9 @@ main(int argc, char **argv) argc -= optind; argv += optind; - if((p = getenv("LC_CTYPE")) || - (p = getenv("LC_ALL")) || - (p = getenv("LANG"))) { + if(((p = getenv("LC_ALL")) && *p) || + ((p = getenv("LC_CTYPE")) && *p) || + ((p = getenv("LANG")) && *p)) { if(strlen(p) >= sizeof(".KOI8-R") && strcasecmp(&p[strlen(p) + 1 - sizeof(".KOI8-R")], ".KOI8-R") == 0) hightab = koi8rtab; diff --git a/gnu/usr.bin/man/catman/catman.perl b/gnu/usr.bin/man/catman/catman.perl index 3eeafed523f8..26ef427371fe 100644 --- a/gnu/usr.bin/man/catman/catman.perl +++ b/gnu/usr.bin/man/catman/catman.perl @@ -46,14 +46,8 @@ sub variables { $remove = 0; # unlink forgotten man/catpages $locale = 0; # go through localized man directories only - # choose localized man directories suffix. If $LC_CTYPE is set, then - # its value should be used as suffix, otherwise $LANG (if set) - $local_suffix = ""; - if ($ENV{'LC_CTYPE'}) { - $local_suffix = $ENV{'LC_CTYPE'} - } elsif ($ENV{'LANG'}) { - $local_suffix = $ENV{'LANG'} - } + # choose localized man directories suffix. + $local_suffix = $ENV{'LC_ALL'} || $ENV{'LC_CTYPE'} || $ENV{'LANG'}; # if no argument for directories given @defaultmanpath = ( '/usr/share/man' ); diff --git a/gnu/usr.bin/man/makewhatis/makewhatis.perl b/gnu/usr.bin/man/makewhatis/makewhatis.perl index 2080aa5b0a64..4a4ab4465464 100644 --- a/gnu/usr.bin/man/makewhatis/makewhatis.perl +++ b/gnu/usr.bin/man/makewhatis/makewhatis.perl @@ -433,14 +433,8 @@ sub variables { $append = 0; # Don't delete old entries $locale = 0; # Build DB only for localized man directories - # choose localized man direcotries suffixs. If $LC_CTYPE is set, then - # its value will be used as suffix, otherwise $LANG value (if set) - $local_suffix = ""; - if ($ENV{'LC_CTYPE'}) { - $local_suffix = $ENV{'LC_CTYPE'}; - } elsif ($ENV{'LANG'}) { - $local_suffix = $ENV{'LANG'} - } + # choose localized man directories suffix. + $local_suffix = $ENV{'LC_ALL'} || $ENV{'LC_CTYPE'} || $ENV{'LANG'}; # if no argument for directories given @defaultmanpath = ( '/usr/share/man' ); diff --git a/gnu/usr.bin/man/man/man.man b/gnu/usr.bin/man/man/man.man index 296db4d504a8..bd2e4ce9d1ba 100644 --- a/gnu/usr.bin/man/man/man.man +++ b/gnu/usr.bin/man/man/man.man @@ -112,7 +112,7 @@ component. .Pp Locale name is taken from the first of three environment variables with a nonempty value: -.Ev LC_CTYPE , LC_ALL , +.Ev LC_ALL , LC_CTYPE , or .Ev LANG , in the specified order. @@ -179,7 +179,7 @@ the files that would be formatted or displayed. .El .Sh ENVIRONMENT .Bl -tag -width MANROFFSEQ -.It Ev LC_CTYPE , LC_ALL , LANG +.It Ev LC_ALL , LC_CTYPE , LANG These variables specify the preferred language for manual pages. (See the .Fl o diff --git a/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh b/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh index 9cb34bbdb83a..be79406fe0c1 100644 --- a/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh +++ b/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh @@ -28,7 +28,7 @@ PATH=/bin:/usr/bin:$PATH export PATH -DATE=`LC_TIME=C date` || exit +DATE=`LC_ALL=C date` || exit # Check whether we have an RCS subdirectory, so we can have the right # prefix for our paths. if test -d RCS diff --git a/release/Makefile b/release/Makefile index 3e8ebd079381..8a0b6811e5d4 100644 --- a/release/Makefile +++ b/release/Makefile @@ -204,7 +204,7 @@ rerelease release: -rm -rf ${CHROOTDIR} .endif mkdir -p ${CHROOTDIR} - @echo ">>> make release started on `LC_TIME=C TZ=GMT date`" + @echo ">>> make release started on `LC_ALL=C TZ=GMT date`" cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR} cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR} if [ -f /etc/resolv.conf ]; then \ @@ -320,7 +320,7 @@ rerelease release: echo "fi" >> ${CHROOTDIR}/mk echo "cd /usr/src/release" >> ${CHROOTDIR}/mk echo "make \$${_RELTARGET}" >> ${CHROOTDIR}/mk - echo "echo \">>> make ${.TARGET} finished on \`LC_TIME=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk + echo "echo \">>> make ${.TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk chmod 755 ${CHROOTDIR}/mk chroot ${CHROOTDIR} /mk diff --git a/secure/lib/libcrypto/Makefile.inc b/secure/lib/libcrypto/Makefile.inc index 5f927eefb9e0..5b25f4c236b5 100644 --- a/secure/lib/libcrypto/Makefile.inc +++ b/secure/lib/libcrypto/Makefile.inc @@ -45,7 +45,7 @@ buildinf.h: echo " /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \ echo " #define CFLAGS \"$(CC)\""; \ echo " #define PLATFORM \"`uname -s`-`uname -m`\""; \ - echo " #define DATE \"`LC_TIME=C date`\""; \ + echo " #define DATE \"`LC_ALL=C date`\""; \ echo "#endif" ) > ${.TARGET} # XXX: The openssl/ dependencies are not correct, in that a change in diff --git a/sys/boot/common/newvers.sh b/sys/boot/common/newvers.sh index ab16fe28d4e5..7a4856c7480f 100755 --- a/sys/boot/common/newvers.sh +++ b/sys/boot/common/newvers.sh @@ -36,7 +36,7 @@ # # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 -LC_TIME=C; export LC_TIME +LC_ALL=C; export LC_ALL u=${USER-root} h=`hostname` t=`date` #r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '` r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1` diff --git a/sys/boot/ficl/Makefile b/sys/boot/ficl/Makefile index 9053b83f60fd..d6db6aed8d98 100644 --- a/sys/boot/ficl/Makefile +++ b/sys/boot/ficl/Makefile @@ -38,6 +38,6 @@ CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${MACHINE_ARCH} -I${.CURDIR}/../common -DFICL softcore.c: ${SOFTWORDS} softcore.awk (cd ${.CURDIR}/softwords; cat ${SOFTWORDS} \ - | awk -f softcore.awk -v datestamp="`LC_TIME=C date`") > ${.TARGET} + | awk -f softcore.awk -v datestamp="`LC_ALL=C date`") > ${.TARGET} diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index fd76146b82d0..f7d30d461558 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -78,7 +78,7 @@ fi COPYRIGHT="$COPYRIGHT " -LC_TIME=C; export LC_TIME +LC_ALL=C; export LC_ALL if [ ! -r version ] then echo 0 > version diff --git a/usr.sbin/kbdmap/kbdmap.pl b/usr.sbin/kbdmap/kbdmap.pl index 6c637776edf6..03536b26ea50 100644 --- a/usr.sbin/kbdmap/kbdmap.pl +++ b/usr.sbin/kbdmap/kbdmap.pl @@ -39,7 +39,7 @@ if ($x11) { sub variables_static { $lang_default = "en"; # set default language - $lang = $ENV{'LC_CTYPE'} || $ENV{'LANG'} || $lang_default; + $lang = $ENV{'LC_ALL'} || $ENV{'LC_CTYPE'} || $ENV{'LANG'} || $lang_default; $lang = &lang($lang); $program = $0; $program =~ s|.*/||; $program =~ s/\.(pl|perl)$//; $keymapdir = "/usr/share/syscons/keymaps"; diff --git a/usr.sbin/named/Makefile.inc b/usr.sbin/named/Makefile.inc index cbebbcbb393a..27b8c40aab66 100644 --- a/usr.sbin/named/Makefile.inc +++ b/usr.sbin/named/Makefile.inc @@ -39,7 +39,7 @@ CLEANFILES+= tmp_version.c pathnames.h CFLAGS+= -I. tmp_version.c: version.c ${BIND_DIR}/Version - (u=$${USER-root} d=`pwd` h=`hostname` t=`LC_TIME=C date`; \ + (u=$${USER-root} d=`pwd` h=`hostname` t=`LC_ALL=C date`; \ sed -e "s|%WHEN%|$${t}|" -e "s|%VERSION%|"${VER}"|" \ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \ < ${BIND_DIR}/bin/named/version.c > tmp_version.c) diff --git a/usr.sbin/ntp/scripts/mkver b/usr.sbin/ntp/scripts/mkver index 20996b85ff9d..075b1972054b 100755 --- a/usr.sbin/ntp/scripts/mkver +++ b/usr.sbin/ntp/scripts/mkver @@ -9,7 +9,7 @@ case "" in *) ConfStr="$ConfStr RSAREF" ;; esac -ConfStr="$ConfStr 4.0.99b `LC_TIME=C date`" +ConfStr="$ConfStr 4.0.99b `LC_ALL=C date`" if [ ! -f .version ]; then echo 0 > .version