setlocale(3) has been fixed to match POSIX standard:

LC_ALL takes precedence over other LC_* envariables.
This commit is contained in:
Ruslan Ermilov 2001-03-02 16:52:14 +00:00
parent 7a6be91366
commit afcf05e46a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=73349
22 changed files with 30 additions and 42 deletions

View file

@ -103,7 +103,7 @@ ${TGTS}: upgrade_checks
# Set a reasonable default # Set a reasonable default
.MAIN: all .MAIN: all
STARTTIME!= LC_TIME=C date STARTTIME!= LC_ALL=C date
# #
# world # world
# #
@ -132,7 +132,7 @@ world: upgrade_checks
.endif .endif
@echo @echo
@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 "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
# #

View file

@ -408,7 +408,7 @@ buildkernel:
@echo @echo
.for _kernel in ${BUILDKERNELS} .for _kernel in ${BUILDKERNELS}
@echo "--------------------------------------------------------------" @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 "--------------------------------------------------------------"
@echo "===> ${_kernel}" @echo "===> ${_kernel}"
mkdir -p ${KRNLOBJDIR} mkdir -p ${KRNLOBJDIR}
@ -431,7 +431,7 @@ buildkernel:
cd ${KRNLOBJDIR}/${_kernel}; \ cd ${KRNLOBJDIR}/${_kernel}; \
${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} all ${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} all
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Kernel build for ${_kernel} completed on `LC_TIME=C date`" @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
.endfor .endfor

View file

@ -4,7 +4,7 @@
# $FreeBSD$ # $FreeBSD$
# Default device. # Default device.
locale=${LC_CTYPE:-$LANG} locale=${LC_ALL:-${LC_CTYPE:-$LANG}}
if test `expr "$locale" : ".*\.ISO_8859-1"` -gt 0 if test `expr "$locale" : ".*\.ISO_8859-1"` -gt 0
then then
T=latin1 T=latin1

View file

@ -7,7 +7,7 @@
# Don't want foreign dates. # Don't want foreign dates.
LANGUAGE= LANGUAGE=
LC_TIME=C; export LC_TIME LC_ALL=C; export LC_ALL
(date; (date;

View file

@ -4,7 +4,7 @@
# $FreeBSD$ # $FreeBSD$
# Default device. # Default device.
locale=${LC_CTYPE:-$LANG} locale=${LC_ALL:-${LC_CTYPE:-$LANG}}
if test `expr "$locale" : ".*\.ISO_8859-1"` -gt 0 if test `expr "$locale" : ".*\.ISO_8859-1"` -gt 0
then then
T=latin1 T=latin1

View file

@ -54,7 +54,7 @@ then
else else
host=`uname -n` host=`uname -n`
fi 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 '#####' in `pwd` | sed 's/\/tmp_mnt//'
echo '#####' using $1 as configuration include directory | sed 's/\/tmp_mnt//' echo '#####' using $1 as configuration include directory | sed 's/\/tmp_mnt//'
echo "define(\`__HOST__', $host)dnl" echo "define(\`__HOST__', $host)dnl"

View file

@ -36,7 +36,7 @@ case "$weekly_whatis_enable" in
then then
for i in ${man_locales} for i in ${man_locales}
do do
LC_CTYPE=$i /usr/libexec/makewhatis.local -a \ LC_ALL=$i /usr/libexec/makewhatis.local -a \
-L "${MANPATH}" || rc=3 -L "${MANPATH}" || rc=3
done done
fi fi

View file

@ -42,7 +42,7 @@ case "$weekly_catman_enable" in
then then
for i in $man_locales for i in $man_locales
do 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 "$MANPATH" | su -fm man || rc=3
done done
fi fi

View file

@ -138,8 +138,8 @@ speaker device file
.El .El
.Sh ENVIRONMENT .Sh ENVIRONMENT
.Bl -tag -width LC_CTYPE -compact .Bl -tag -width LC_CTYPE -compact
.It Ev LC_CTYPE
.It Ev LC_ALL .It Ev LC_ALL
.It Ev LC_CTYPE
.It Ev LANG .It Ev LANG
If one of these variables (in this priority) is set to a locale ending in If one of these variables (in this priority) is set to a locale ending in
.Ql KOI8-R , .Ql KOI8-R ,

View file

@ -318,9 +318,9 @@ main(int argc, char **argv)
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if((p = getenv("LC_CTYPE")) || if(((p = getenv("LC_ALL")) && *p) ||
(p = getenv("LC_ALL")) || ((p = getenv("LC_CTYPE")) && *p) ||
(p = getenv("LANG"))) { ((p = getenv("LANG")) && *p)) {
if(strlen(p) >= sizeof(".KOI8-R") && if(strlen(p) >= sizeof(".KOI8-R") &&
strcasecmp(&p[strlen(p) + 1 - sizeof(".KOI8-R")], ".KOI8-R") == 0) strcasecmp(&p[strlen(p) + 1 - sizeof(".KOI8-R")], ".KOI8-R") == 0)
hightab = koi8rtab; hightab = koi8rtab;

View file

@ -46,14 +46,8 @@ sub variables {
$remove = 0; # unlink forgotten man/catpages $remove = 0; # unlink forgotten man/catpages
$locale = 0; # go through localized man directories only $locale = 0; # go through localized man directories only
# choose localized man directories suffix. If $LC_CTYPE is set, then # choose localized man directories suffix.
# its value should be used as suffix, otherwise $LANG (if set) $local_suffix = $ENV{'LC_ALL'} || $ENV{'LC_CTYPE'} || $ENV{'LANG'};
$local_suffix = "";
if ($ENV{'LC_CTYPE'}) {
$local_suffix = $ENV{'LC_CTYPE'}
} elsif ($ENV{'LANG'}) {
$local_suffix = $ENV{'LANG'}
}
# if no argument for directories given # if no argument for directories given
@defaultmanpath = ( '/usr/share/man' ); @defaultmanpath = ( '/usr/share/man' );

View file

@ -433,14 +433,8 @@ sub variables {
$append = 0; # Don't delete old entries $append = 0; # Don't delete old entries
$locale = 0; # Build DB only for localized man directories $locale = 0; # Build DB only for localized man directories
# choose localized man direcotries suffixs. If $LC_CTYPE is set, then # choose localized man directories suffix.
# its value will be used as suffix, otherwise $LANG value (if set) $local_suffix = $ENV{'LC_ALL'} || $ENV{'LC_CTYPE'} || $ENV{'LANG'};
$local_suffix = "";
if ($ENV{'LC_CTYPE'}) {
$local_suffix = $ENV{'LC_CTYPE'};
} elsif ($ENV{'LANG'}) {
$local_suffix = $ENV{'LANG'}
}
# if no argument for directories given # if no argument for directories given
@defaultmanpath = ( '/usr/share/man' ); @defaultmanpath = ( '/usr/share/man' );

View file

@ -112,7 +112,7 @@ component.
.Pp .Pp
Locale name is taken from the first of three environment variables Locale name is taken from the first of three environment variables
with a nonempty value: with a nonempty value:
.Ev LC_CTYPE , LC_ALL , .Ev LC_ALL , LC_CTYPE ,
or or
.Ev LANG , .Ev LANG ,
in the specified order. in the specified order.
@ -179,7 +179,7 @@ the files that would be formatted or displayed.
.El .El
.Sh ENVIRONMENT .Sh ENVIRONMENT
.Bl -tag -width MANROFFSEQ .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. These variables specify the preferred language for manual pages.
(See the (See the
.Fl o .Fl o

View file

@ -28,7 +28,7 @@
PATH=/bin:/usr/bin:$PATH PATH=/bin:/usr/bin:$PATH
export 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 # Check whether we have an RCS subdirectory, so we can have the right
# prefix for our paths. # prefix for our paths.
if test -d RCS if test -d RCS

View file

@ -204,7 +204,7 @@ rerelease release:
-rm -rf ${CHROOTDIR} -rm -rf ${CHROOTDIR}
.endif .endif
mkdir -p ${CHROOTDIR} 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} distrib-dirs DESTDIR=${CHROOTDIR}
cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR} cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
if [ -f /etc/resolv.conf ]; then \ if [ -f /etc/resolv.conf ]; then \
@ -320,7 +320,7 @@ rerelease release:
echo "fi" >> ${CHROOTDIR}/mk echo "fi" >> ${CHROOTDIR}/mk
echo "cd /usr/src/release" >> ${CHROOTDIR}/mk echo "cd /usr/src/release" >> ${CHROOTDIR}/mk
echo "make \$${_RELTARGET}" >> ${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 chmod 755 ${CHROOTDIR}/mk
chroot ${CHROOTDIR} /mk chroot ${CHROOTDIR} /mk

View file

@ -45,7 +45,7 @@ buildinf.h:
echo " /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \ echo " /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \
echo " #define CFLAGS \"$(CC)\""; \ echo " #define CFLAGS \"$(CC)\""; \
echo " #define PLATFORM \"`uname -s`-`uname -m`\""; \ echo " #define PLATFORM \"`uname -s`-`uname -m`\""; \
echo " #define DATE \"`LC_TIME=C date`\""; \ echo " #define DATE \"`LC_ALL=C date`\""; \
echo "#endif" ) > ${.TARGET} echo "#endif" ) > ${.TARGET}
# XXX: The openssl/ dependencies are not correct, in that a change in # XXX: The openssl/ dependencies are not correct, in that a change in

View file

@ -36,7 +36,7 @@
# #
# @(#)newvers.sh 8.1 (Berkeley) 4/20/94 # @(#)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` u=${USER-root} h=`hostname` t=`date`
#r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '` #r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '`
r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1` r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1`

View file

@ -38,6 +38,6 @@ CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${MACHINE_ARCH} -I${.CURDIR}/../common -DFICL
softcore.c: ${SOFTWORDS} softcore.awk softcore.c: ${SOFTWORDS} softcore.awk
(cd ${.CURDIR}/softwords; cat ${SOFTWORDS} \ (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}

View file

@ -78,7 +78,7 @@ fi
COPYRIGHT="$COPYRIGHT COPYRIGHT="$COPYRIGHT
" "
LC_TIME=C; export LC_TIME LC_ALL=C; export LC_ALL
if [ ! -r version ] if [ ! -r version ]
then then
echo 0 > version echo 0 > version

View file

@ -39,7 +39,7 @@ if ($x11) {
sub variables_static { sub variables_static {
$lang_default = "en"; # set default language $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); $lang = &lang($lang);
$program = $0; $program =~ s|.*/||; $program =~ s/\.(pl|perl)$//; $program = $0; $program =~ s|.*/||; $program =~ s/\.(pl|perl)$//;
$keymapdir = "/usr/share/syscons/keymaps"; $keymapdir = "/usr/share/syscons/keymaps";

View file

@ -39,7 +39,7 @@ CLEANFILES+= tmp_version.c pathnames.h
CFLAGS+= -I. CFLAGS+= -I.
tmp_version.c: version.c ${BIND_DIR}/Version 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}"|" \ sed -e "s|%WHEN%|$${t}|" -e "s|%VERSION%|"${VER}"|" \
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
< ${BIND_DIR}/bin/named/version.c > tmp_version.c) < ${BIND_DIR}/bin/named/version.c > tmp_version.c)

View file

@ -9,7 +9,7 @@ case "" in
*) ConfStr="$ConfStr RSAREF" ;; *) ConfStr="$ConfStr RSAREF" ;;
esac esac
ConfStr="$ConfStr 4.0.99b `LC_TIME=C date`" ConfStr="$ConfStr 4.0.99b `LC_ALL=C date`"
if [ ! -f .version ]; then if [ ! -f .version ]; then
echo 0 > .version echo 0 > .version