PERFORCE change 15713 for review

Robert Watson rwatson at freebsd.org
Fri Aug 9 05:59:26 GMT 2002


http://people.freebsd.org/~peter/p4db/chv.cgi?CH=15713

Change 15713 by rwatson at rwatson_tislabs on 2002/08/08 22:59:03

	Integ main -CURRENT tree into trustedbsd base.

Affected files ...

.. //depot/projects/trustedbsd/base/Makefile.inc1#21 integrate
.. //depot/projects/trustedbsd/base/bin/kenv/Makefile#1 branch
.. //depot/projects/trustedbsd/base/bin/kenv/kenv.1#1 branch
.. //depot/projects/trustedbsd/base/bin/kenv/kenv.c#1 branch
.. //depot/projects/trustedbsd/base/etc/isdn/Makefile#4 integrate
.. //depot/projects/trustedbsd/base/gnu/usr.bin/groff/tmac/koi8-r#4 integrate
.. //depot/projects/trustedbsd/base/gnu/usr.bin/man/apropos/apropos.man#4 integrate
.. //depot/projects/trustedbsd/base/gnu/usr.bin/man/apropos/apropos.sh#2 integrate
.. //depot/projects/trustedbsd/base/include/Makefile#13 integrate
.. //depot/projects/trustedbsd/base/include/ulimit.h#1 branch
.. //depot/projects/trustedbsd/base/lib/libc/gen/Makefile.inc#10 integrate
.. //depot/projects/trustedbsd/base/lib/libc/gen/ulimit.3#1 branch
.. //depot/projects/trustedbsd/base/lib/libc/gen/ulimit.c#1 branch
.. //depot/projects/trustedbsd/base/lib/libc/i386/sys/sbrk.S#4 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/collate.c#3 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/collate.h#4 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/euc.c#3 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/ldpart.c#6 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/ldpart.h#4 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/lmessages.c#5 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/lmonetary.c#5 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/lnumeric.c#4 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/rune.c#4 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/setlocale.c#6 integrate
.. //depot/projects/trustedbsd/base/lib/libc/locale/setrunelocale.c#4 integrate
.. //depot/projects/trustedbsd/base/lib/libc/nls/msgcat.c#4 integrate
.. //depot/projects/trustedbsd/base/lib/libc/posix1e/mac_te.c#2 integrate
.. //depot/projects/trustedbsd/base/lib/libc/posix1e/mac_text.c#2 integrate
.. //depot/projects/trustedbsd/base/lib/libc/posix1e/posix1e.3#2 integrate
.. //depot/projects/trustedbsd/base/lib/libc/stdtime/timelocal.c#5 integrate
.. //depot/projects/trustedbsd/base/lib/libc/string/strsep.3#2 integrate
.. //depot/projects/trustedbsd/base/lib/libc/sys/execve.2#5 integrate
.. //depot/projects/trustedbsd/base/lib/libc/sys/getrlimit.2#2 integrate
.. //depot/projects/trustedbsd/base/libexec/ftpd/ftpd.8#4 integrate
.. //depot/projects/trustedbsd/base/libexec/ftpd/ftpd.c#11 integrate
.. //depot/projects/trustedbsd/base/libexec/rtld-elf/rtld.c#7 integrate
.. //depot/projects/trustedbsd/base/sbin/mount_nfs/mount_nfs.c#6 integrate
.. //depot/projects/trustedbsd/base/share/man/man4/nge.4#4 integrate
.. //depot/projects/trustedbsd/base/sys/alpha/include/pmap.h#7 integrate
.. //depot/projects/trustedbsd/base/sys/boot/i386/libi386/i386_module.c#2 integrate
.. //depot/projects/trustedbsd/base/sys/conf/kmod_syms.awk#4 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ata/atapi-cd.c#13 integrate
.. //depot/projects/trustedbsd/base/sys/dev/ata/atapi-cd.h#5 integrate
.. //depot/projects/trustedbsd/base/sys/dev/fxp/if_fxp.c#13 integrate
.. //depot/projects/trustedbsd/base/sys/dev/mii/mii.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/dev/nge/if_nge.c#10 integrate
.. //depot/projects/trustedbsd/base/sys/dev/nge/if_ngereg.h#3 integrate
.. //depot/projects/trustedbsd/base/sys/dev/sn/if_sn_pccard.c#5 integrate
.. //depot/projects/trustedbsd/base/sys/dev/sound/usb/uaudio.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/ohci.c#14 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/ucom.c#6 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/udbp.c#6 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/ufm.c#6 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/ugen.c#10 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/uhci.c#18 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/uhid.c#8 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/uhub.c#9 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/ukbd.c#6 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/ulpt.c#8 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/umass.c#14 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/umodem.c#8 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/ums.c#9 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/uplcom.c#5 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/urio.c#8 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/usb.c#11 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/usb_port.h#10 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/uscanner.c#8 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/uvisor.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/dev/usb/uvscom.c#6 integrate
.. //depot/projects/trustedbsd/base/sys/i386/acpica/acpi_wakeup.c#7 integrate
.. //depot/projects/trustedbsd/base/sys/i386/conf/GENERIC#16 integrate
.. //depot/projects/trustedbsd/base/sys/i386/conf/OLDCARD#4 integrate
.. //depot/projects/trustedbsd/base/sys/i386/isa/vesa.c#2 integrate
.. //depot/projects/trustedbsd/base/sys/ia64/include/pmap.h#5 integrate
.. //depot/projects/trustedbsd/base/sys/kern/init_main.c#15 integrate
.. //depot/projects/trustedbsd/base/sys/kern/kern_acct.c#7 integrate
.. //depot/projects/trustedbsd/base/sys/kern/kern_fork.c#17 integrate
.. //depot/projects/trustedbsd/base/sys/kern/kern_sig.c#19 integrate
.. //depot/projects/trustedbsd/base/sys/kern/subr_clock.c#2 integrate
.. //depot/projects/trustedbsd/base/sys/kern/subr_mbuf.c#13 integrate
.. //depot/projects/trustedbsd/base/sys/kern/tty_cons.c#5 integrate
.. //depot/projects/trustedbsd/base/sys/kern/uipc_syscalls.c#16 integrate
.. //depot/projects/trustedbsd/base/sys/kern/vfs_aio.c#16 integrate
.. //depot/projects/trustedbsd/base/sys/kern/vfs_vnops.c#21 integrate
.. //depot/projects/trustedbsd/base/sys/pci/if_sis.c#12 integrate
.. //depot/projects/trustedbsd/base/sys/pci/if_ste.c#5 integrate
.. //depot/projects/trustedbsd/base/sys/pci/if_stereg.h#2 integrate
.. //depot/projects/trustedbsd/base/sys/powerpc/include/pmap.h#5 integrate
.. //depot/projects/trustedbsd/base/sys/sparc64/include/pmap.h#11 integrate
.. //depot/projects/trustedbsd/base/sys/sys/cdrio.h#4 integrate
.. //depot/projects/trustedbsd/base/sys/sys/proc.h#18 integrate
.. //depot/projects/trustedbsd/base/sys/sys/vnode.h#20 integrate
.. //depot/projects/trustedbsd/base/sys/vm/vm_page.c#16 integrate
.. //depot/projects/trustedbsd/base/usr.bin/make/main.c#6 integrate
.. //depot/projects/trustedbsd/base/usr.bin/quota/quota.1#3 integrate
.. //depot/projects/trustedbsd/base/usr.bin/quota/quota.c#5 integrate
.. //depot/projects/trustedbsd/base/usr.bin/su/su.c#7 integrate
.. //depot/projects/trustedbsd/base/usr.bin/truss/syscalls.c#7 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/burncd/burncd.8#6 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/burncd/burncd.c#9 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/crunch/crunchgen/crunched_main.c#3 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/edquota/edquota.c#4 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/inetd/inetd.8#5 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/inetd/inetd.c#5 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/inetd/inetd.h#3 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/anonFTP.c#2 integrate
.. //depot/projects/trustedbsd/base/usr.sbin/sysinstall/config.c#7 integrate

Differences ...

==== //depot/projects/trustedbsd/base/Makefile.inc1#21 (text+ko) ====

@@ -1,5 +1,5 @@
 #
-# $FreeBSD: src/Makefile.inc1,v 1.300 2002/08/05 08:54:26 ru Exp $
+# $FreeBSD: src/Makefile.inc1,v 1.302 2002/08/08 15:43:23 ru Exp $
 #
 # Make command line options:
 #	-DMAKE_KERBEROS4 to build KerberosIV
@@ -131,9 +131,14 @@
 TARGET?=	${TARGET_ARCH}
 TARGET_CPUTYPE?=
 .endif
-_CPUTYPE!=	cd ${.CURDIR}; ${MAKE} -m ${.CURDIR}/share/mk \
-		CPUTYPE=X${TARGET_CPUTYPE} -V CPUTYPE
-.if ${_CPUTYPE} != X${TARGET_CPUTYPE}
+.if !empty(TARGET_CPUTYPE)
+_TARGET_CPUTYPE=${TARGET_CPUTYPE}
+.else
+_TARGET_CPUTYPE=dummy
+.endif
+_CPUTYPE!=	${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
+		CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
+.if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
 .error CPUTYPE global should be set with ?=.
 .endif
 .if make(buildworld)

==== //depot/projects/trustedbsd/base/etc/isdn/Makefile#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/isdn/Makefile,v 1.8 2002/07/29 09:40:05 ru Exp $
+# $FreeBSD: src/etc/isdn/Makefile,v 1.9 2002/08/07 16:01:06 ru Exp $
 
 I4BETCPROG=	answer			\
 		isdntel.sh		\
@@ -23,6 +23,3 @@
 		for i in ${I4BETCFILE} ; do \
 		  ${INSTALL} -o root -g wheel -m 600 $$i ${DESTDIR}/etc/isdn ; \
 		done
-
-# Suck in the ${COPY} definition.
-.include <bsd.own.mk>

==== //depot/projects/trustedbsd/base/gnu/usr.bin/groff/tmac/koi8-r#4 (text+ko) ====

@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/gnu/usr.bin/groff/tmac/koi8-r,v 1.6 2002/01/11 11:42:16 ru Exp $
+.\" $FreeBSD: src/gnu/usr.bin/groff/tmac/koi8-r,v 1.7 2002/08/07 17:47:24 ru Exp $
 .\"
 .\"     %beginstrip%
 .
@@ -119,6 +119,15 @@
 .as doc-str-Rv-std0 " Á ËÏÄ ÏÛÉÂËÉ ÓÏÈÒÁÎÑÅÔÓÑ × ÇÌÏÂÁÌØÎÏÊ
 .as doc-str-Rv-std0 " ÐÅÒÅÍÅÎÎÏÊ \*[doc-Va-font]errno\f[P].
 .
+.\" ÌÏËÁÌÉÚÁÃÉÑ .Ex
+.ds doc-str-Ex-std-prefix "õÔÉÌÉÔÁ
+.ds doc-str-Ex-std-suffix "×ÏÚ×ÒÁÝÁÅÔ\~0 × ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ
+.as doc-str-Ex-std-suffix " É\~>0 × ÓÌÕÞÁÅ ×ÏÚÎÉËÎÏ×ÅÎÉÑ ÏÛÉÂËÉ.
+.
+.ds doc-str-Ex-stds-prefix "õÔÉÌÉÔÙ
+.ds doc-str-Ex-stds-suffix "×ÏÚ×ÒÁÝÁÀÔ\~0 × ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ
+.as doc-str-Ex-stds-suffix " É\~>0 × ÓÌÕÞÁÅ ×ÏÚÎÉËÎÏ×ÅÎÉÑ ÏÛÉÂËÉ.
+.
 .\" ÌÏËÁÌÉÚÁÃÉÑ .Ar
 .ds doc-str-Ar-default "ÆÁÊÌ\ .\|.\|.
 .

==== //depot/projects/trustedbsd/base/gnu/usr.bin/man/apropos/apropos.man#4 (text+ko) ====

@@ -12,7 +12,7 @@
 .\" The University of Texas at Austin
 .\" Austin, Texas  78712
 .\"
-.\" $FreeBSD: src/gnu/usr.bin/man/apropos/apropos.man,v 1.10 2002/03/12 20:00:52 charnier Exp $
+.\" $FreeBSD: src/gnu/usr.bin/man/apropos/apropos.man,v 1.11 2002/08/07 17:39:35 ru Exp $
 .Dd January 15, 1991
 .Dt APROPOS 1
 .Os
@@ -34,7 +34,7 @@
 displays only complete word matches. 
 .Pp
 .Ar keyword
-really is a regular expression, please read
+really is an extended regular expression, please read
 .Xr grep 1
 manual page for more information about its format.
 .Sh DIAGNOSTICS

==== //depot/projects/trustedbsd/base/gnu/usr.bin/man/apropos/apropos.sh#2 (text+ko) ====

@@ -15,7 +15,7 @@
 # The University of Texas at Austin
 # Austin, Texas  78712
 #
-# $FreeBSD: src/gnu/usr.bin/man/apropos/apropos.sh,v 1.14 2001/03/30 10:44:29 wosch Exp $
+# $FreeBSD: src/gnu/usr.bin/man/apropos/apropos.sh,v 1.15 2002/08/07 17:39:35 ru Exp $
 
 
 PATH=/bin:/usr/bin:$PATH
@@ -84,7 +84,7 @@
 
 for manpage
 do
-	if grep -hi $grepopt -- "$manpage" $mandir; then :
+	if grep -Ehi $grepopt -- "$manpage" $mandir; then :
 	else
         	echo "$manpage: nothing appropriate"
 	fi

==== //depot/projects/trustedbsd/base/include/Makefile#13 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.2 (Berkeley) 1/4/94
-# $FreeBSD: src/include/Makefile,v 1.174 2002/08/05 06:49:58 mike Exp $
+# $FreeBSD: src/include/Makefile,v 1.175 2002/08/08 04:50:36 mike Exp $
 #
 # Doing a make install builds /usr/include
 #
@@ -21,7 +21,8 @@
 	search.h setjmp.h sgtty.h \
 	signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h strhash.h \
 	string.h stringlist.h strings.h sysexits.h tar.h time.h timeconv.h \
-	timers.h ttyent.h unistd.h utime.h utmp.h vis.h wchar.h wctype.h
+	timers.h ttyent.h ulimit.h unistd.h utime.h utmp.h vis.h wchar.h \
+	wctype.h
 
 MHDRS=	float.h floatingpoint.h stdarg.h varargs.h
 

==== //depot/projects/trustedbsd/base/lib/libc/gen/Makefile.inc#10 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile.inc	8.6 (Berkeley) 5/4/95
-# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.93 2002/08/05 06:49:58 mike Exp $
+# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.94 2002/08/08 04:50:36 mike Exp $
 
 # machine-independent gen sources
 .PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/gen ${.CURDIR}/../libc/gen
@@ -28,8 +28,8 @@
 	sigsetops.c sleep.c srand48.c statvfs.c stringlist.c strtofflags.c \
 	sysconf.c sysctl.c sysctlbyname.c sysctlnametomib.c \
 	syslog.c telldir.c termios.c time.c times.c timezone.c ttyname.c \
-	ttyslot.c ualarm.c uname.c unvis.c usleep.c utime.c valloc.c vis.c \
-	wait.c wait3.c waitpid.c
+	ttyslot.c ualarm.c ulimit.c uname.c unvis.c usleep.c utime.c \
+	valloc.c vis.c wait.c wait3.c waitpid.c
 
 # machine-dependent gen sources
 .if exists(${.CURDIR}/../libc/${MACHINE_ARCH}/gen/Makefile.inc)
@@ -56,7 +56,7 @@
 	siginterrupt.3 signal.3 sigsetops.3 sleep.3 statvfs.3 stringlist.3 \
 	strtofflags.3 sysconf.3 sysctl.3 syslog.3 tcgetpgrp.3 \
 	tcsendbreak.3 tcsetattr.3 tcsetpgrp.3 time.3 times.3 timezone.3 \
-	ttyname.3 tzset.3 ualarm.3 uname.3 unvis.3 usleep.3 utime.3 \
+	ttyname.3 tzset.3 ualarm.3 ulimit.3 uname.3 unvis.3 usleep.3 utime.3 \
 	valloc.3 vis.3
 
 MLINKS+=arc4random.3 arc4random_addrandom.3 arc4random.3 arc4random_stir.3

==== //depot/projects/trustedbsd/base/lib/libc/i386/sys/sbrk.S#4 (text+ko) ====

@@ -38,17 +38,17 @@
 	.asciz "@(#)sbrk.s	5.1 (Berkeley) 4/23/90"
 #endif /* SYSLIBC_SCCS and not lint */
 #include <machine/asm.h>
-__FBSDID("$FreeBSD: src/lib/libc/i386/sys/sbrk.S,v 1.10 2002/03/23 02:10:28 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/i386/sys/sbrk.S,v 1.11 2002/08/08 17:28:07 kan Exp $");
 
 #include "SYS.h"
 
-	.globl	CNAME(end)
+	.globl	CNAME(_end)
 	.globl	HIDENAME(minbrk)
 	.globl	HIDENAME(curbrk)
 
 	.data
-HIDENAME(minbrk):	.long	CNAME(end)
-HIDENAME(curbrk):	.long	CNAME(end)
+HIDENAME(minbrk):	.long	CNAME(_end)
+HIDENAME(curbrk):	.long	CNAME(_end)
 	.text
 
 ENTRY(sbrk)

==== //depot/projects/trustedbsd/base/lib/libc/locale/collate.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/collate.c,v 1.24 2002/03/29 22:43:42 markm Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/locale/collate.c,v 1.26 2002/08/08 05:51:54 ache Exp $");
 
 #include "namespace.h"
 #include <rune.h>
@@ -40,68 +40,115 @@
 
 #include "collate.h"
 #include "setlocale.h"
+#include "ldpart.h"
 
 #include "libc_private.h"
 
 int __collate_load_error = 1;
 int __collate_substitute_nontrivial;
-char __collate_version[STR_LEN];
+
 u_char __collate_substitute_table[UCHAR_MAX + 1][STR_LEN];
 struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
 struct __collate_st_chain_pri __collate_chain_pri_table[TABLE_SIZE];
 
-#define FREAD(a, b, c, d) \
-	do { \
-		if (fread(a, b, c, d) != c) { \
-			fclose(d); \
-			return -1; \
-		} \
-	} while(0)
-
 void __collate_err(int ex, const char *f) __dead2;
 
 int
-__collate_load_tables(encoding)
-	char *encoding;
+__collate_load_tables(const char *encoding)
 {
+	FILE *fp;
+	int i, saverr;
+	char collate_version[STR_LEN];
 	char buf[PATH_MAX];
-	FILE *fp;
-	int i, save_load_error;
+	char *TMP_substitute_table, *TMP_char_pri_table, *TMP_chain_pri_table;
+	static char collate_encoding[ENCODING_LEN + 1];
 
-	save_load_error = __collate_load_error;
-	__collate_load_error = 1;
-	if (!encoding) {
-		__collate_load_error = save_load_error;
-		return -1;
+	/* 'encoding' must be already checked. */
+	if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) {
+		__collate_load_error = 1;
+		return (_LDP_CACHE);
 	}
-	if (!strcmp(encoding, "C") || !strcmp(encoding, "POSIX"))
-		return 0;
-	if (!_PathLocale) {
-		__collate_load_error = save_load_error;
-		return -1;
+
+	/*
+	 * If the locale name is the same as our cache, use the cache.
+	 */
+	if (strcmp(encoding, collate_encoding) == 0) {
+		__collate_load_error = 0;
+		return (_LDP_CACHE);
 	}
+
+	/*
+	 * Slurp the locale file into the cache.
+	 */
+
+	/* 'PathLocale' must be already set & checked. */
 	/* Range checking not needed, encoding has fixed size */
-	(void) strcpy(buf, _PathLocale);
-	(void) strcat(buf, "/");
-	(void) strcat(buf, encoding);
-	(void) strcat(buf, "/LC_COLLATE");
-	if ((fp = fopen(buf, "r")) == NULL) {
-		__collate_load_error = save_load_error;
-		return -1;
+	(void)strcpy(buf, _PathLocale);
+	(void)strcat(buf, "/");
+	(void)strcat(buf, encoding);
+	(void)strcat(buf, "/LC_COLLATE");
+	if ((fp = fopen(buf, "r")) == NULL)
+		return (_LDP_ERROR);
+
+	if ((TMP_substitute_table =
+	     malloc(sizeof(__collate_substitute_table))) == NULL) {
+		(void)fclose(fp);
+		errno = ENOMEM;
+		return (_LDP_ERROR);
+	}
+	if ((TMP_char_pri_table =
+	     malloc(sizeof(__collate_char_pri_table))) == NULL) {
+		free(TMP_substitute_table);
+		(void)fclose(fp);
+		errno = ENOMEM;
+		return (_LDP_ERROR);
+	}
+	if ((TMP_chain_pri_table =
+	     malloc(sizeof(__collate_chain_pri_table))) == NULL) {
+		free(TMP_substitute_table);
+		free(TMP_char_pri_table);
+		(void)fclose(fp);
+		errno = ENOMEM;
+		return (_LDP_ERROR);
 	}
-	FREAD(__collate_version, sizeof(__collate_version), 1, fp);
-	if (strcmp(__collate_version, COLLATE_VERSION) != 0) {
-		fclose(fp);
-		return -1;
+
+#define FREAD(a, b, c, d) \
+{ \
+	if (fread(a, b, c, d) != c) { \
+		saverr = errno; \
+		free(TMP_substitute_table); \
+		free(TMP_char_pri_table); \
+		free(TMP_chain_pri_table); \
+		(void)fclose(d); \
+		errno = saverr; \
+		return (_LDP_ERROR); \
+	} \
+}
+
+	FREAD(collate_version, sizeof(collate_version), 1, fp);
+	if (strcmp(collate_version, COLLATE_VERSION) != 0) {
+		free(TMP_substitute_table);
+		free(TMP_char_pri_table);
+		free(TMP_chain_pri_table);
+		(void)fclose(fp);
+		errno = EFTYPE;
+		return (_LDP_ERROR);
 	}
-	FREAD(__collate_substitute_table, sizeof(__collate_substitute_table),
-	      1, fp);
-	FREAD(__collate_char_pri_table, sizeof(__collate_char_pri_table), 1,
-	      fp);
-	FREAD(__collate_chain_pri_table, sizeof(__collate_chain_pri_table), 1,
-	      fp);
-	fclose(fp);
-	__collate_load_error = 0;
+	FREAD(TMP_substitute_table, sizeof(__collate_substitute_table), 1, fp);
+	FREAD(TMP_char_pri_table, sizeof(__collate_char_pri_table), 1, fp);
+	FREAD(TMP_chain_pri_table, sizeof(__collate_chain_pri_table), 1, fp);
+	(void)fclose(fp);
+
+	(void)strcpy(collate_encoding, encoding);
+	(void)memcpy(__collate_substitute_table, TMP_substitute_table,
+		     sizeof(__collate_substitute_table));
+	(void)memcpy(__collate_char_pri_table, TMP_char_pri_table,
+		     sizeof(__collate_char_pri_table));
+	(void)memcpy(__collate_chain_pri_table, TMP_chain_pri_table,
+		     sizeof(__collate_chain_pri_table));
+	free(TMP_substitute_table);
+	free(TMP_char_pri_table);
+	free(TMP_chain_pri_table);
 	
 	__collate_substitute_nontrivial = 0;
 	for (i = 0; i < UCHAR_MAX + 1; i++) {
@@ -111,8 +158,9 @@
 			break;
 		}
 	}
+	__collate_load_error = 0;
 
-	return 0;
+	return (_LDP_LOADED);
 }
 
 u_char *
@@ -123,24 +171,24 @@
 	int delta = strlen(s);
 	u_char *dest_str = NULL;
 
-	if(s == NULL || *s == '\0')
-		return __collate_strdup("");
+	if (s == NULL || *s == '\0')
+		return (__collate_strdup(""));
 	delta += delta / 8;
 	dest_str = malloc(dest_len = delta);
-	if(dest_str == NULL)
+	if (dest_str == NULL)
 		__collate_err(EX_OSERR, __FUNCTION__);
 	len = 0;
-	while(*s) {
+	while (*s) {
 		nlen = len + strlen(__collate_substitute_table[*s]);
 		if (dest_len <= nlen) {
 			dest_str = reallocf(dest_str, dest_len = nlen + delta);
-			if(dest_str == NULL)
+			if (dest_str == NULL)
 				__collate_err(EX_OSERR, __FUNCTION__);
 		}
-		strcpy(dest_str + len, __collate_substitute_table[*s++]);
+		(void)strcpy(dest_str + len, __collate_substitute_table[*s++]);
 		len = nlen;
 	}
-	return dest_str;
+	return (dest_str);
 }
 
 void
@@ -152,8 +200,8 @@
 
 	*len = 1;
 	*prim = *sec = 0;
-	for(p2 = __collate_chain_pri_table; p2->str[0]; p2++) {
-		if(strncmp(t, p2->str, strlen(p2->str)) == 0) {
+	for (p2 = __collate_chain_pri_table; p2->str[0]; p2++) {
+		if (strncmp(t, p2->str, strlen(p2->str)) == 0) {
 			*len = strlen(p2->str);
 			*prim = p2->prim;
 			*sec = p2->sec;
@@ -172,7 +220,7 @@
 
 	if (t == NULL)
 		__collate_err(EX_OSERR, __FUNCTION__);
-	return t;
+	return (t);
 }
 
 void

==== //depot/projects/trustedbsd/base/lib/libc/locale/collate.h#4 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libc/locale/collate.h,v 1.11 2002/03/21 22:46:54 obrien Exp $
+ * $FreeBSD: src/lib/libc/locale/collate.h,v 1.12 2002/08/08 05:51:54 ache Exp $
  */
 
 #ifndef _COLLATE_H_
@@ -48,7 +48,6 @@
 
 extern int __collate_load_error;
 extern int __collate_substitute_nontrivial;
-extern char __collate_version[STR_LEN];
 extern u_char __collate_substitute_table[UCHAR_MAX + 1][STR_LEN];
 extern struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
 extern struct __collate_st_chain_pri __collate_chain_pri_table[TABLE_SIZE];
@@ -56,7 +55,7 @@
 __BEGIN_DECLS
 u_char	*__collate_strdup(u_char *);
 u_char	*__collate_substitute(const u_char *);
-int	__collate_load_tables(char *);
+int	__collate_load_tables(const char *);
 void	__collate_lookup(const u_char *, int *, int *, int *);
 int	__collate_range_cmp(int, int);
 #ifdef COLLATE_DEBUG

==== //depot/projects/trustedbsd/base/lib/libc/locale/euc.c#3 (text+ko) ====

@@ -38,7 +38,7 @@
 static char sccsid[] = "@(#)euc.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/euc.c,v 1.8 2002/04/14 10:55:42 asmodai Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/locale/euc.c,v 1.10 2002/08/08 05:51:54 ache Exp $");
 
 #include <sys/types.h>
 
@@ -63,40 +63,36 @@
 	_RuneLocale *rl;
 {
 	_EucInfo *ei;
-	int x;
+	int x, new__mb_cur_max;
 	char *v, *e;
 
 	rl->sgetrune = _EUC_sgetrune;
 	rl->sputrune = _EUC_sputrune;
 
-	if (!rl->variable) {
-		free(rl);
+	if (rl->variable == NULL)
 		return (EFTYPE);
-	}
-	v = (char *) rl->variable;
+
+	v = (char *)rl->variable;
 
 	while (*v == ' ' || *v == '\t')
 		++v;
 
-	if ((ei = malloc(sizeof(_EucInfo))) == NULL) {
-		free(rl);
+	if ((ei = malloc(sizeof(_EucInfo))) == NULL)
 		return (ENOMEM);
-	}
-	__mb_cur_max = 0;
+
+	new__mb_cur_max = 0;
 	for (x = 0; x < 4; ++x) {
-		ei->count[x] = (int) strtol(v, &e, 0);
+		ei->count[x] = (int)strtol(v, &e, 0);
 		if (v == e || !(v = e)) {
-			free(rl);
 			free(ei);
 			return (EFTYPE);
 		}
-		if (__mb_cur_max < ei->count[x])
-			__mb_cur_max = ei->count[x];
+		if (new__mb_cur_max < ei->count[x])
+			new__mb_cur_max = ei->count[x];
 		while (*v == ' ' || *v == '\t')
 			++v;
-		ei->bits[x] = (int) strtol(v, &e, 0);
+		ei->bits[x] = (int)strtol(v, &e, 0);
 		if (v == e || !(v = e)) {
-			free(rl);
 			free(ei);
 			return (EFTYPE);
 		}
@@ -105,18 +101,13 @@
 	}
 	ei->mask = (int)strtol(v, &e, 0);
 	if (v == e || !(v = e)) {
-		free(rl);
 		free(ei);
 		return (EFTYPE);
 	}
-	if (sizeof(_EucInfo) <= rl->variable_len) {
-		memcpy(rl->variable, ei, sizeof(_EucInfo));
-		free(ei);
-	} else {
-		rl->variable = &ei;
-	}
+	rl->variable = ei;
 	rl->variable_len = sizeof(_EucInfo);
 	_CurrentRuneLocale = rl;
+	__mb_cur_max = new__mb_cur_max;
 	return (0);
 }
 

==== //depot/projects/trustedbsd/base/lib/libc/locale/ldpart.c#6 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/ldpart.c,v 1.9 2002/08/04 09:37:28 ache Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/locale/ldpart.c,v 1.11 2002/08/08 05:51:54 ache Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
@@ -42,7 +42,6 @@
 #include "ldpart.h"
 
 static int split_lines(char *, const char *);
-static void set_from_buf(const char *, int, const char **);
 
 int
 __part_load_locale(const char *name,
@@ -53,35 +52,25 @@
 		int locale_buf_size_min,
 		const char **dst_localebuf)
 {
-	static char		locale_buf_C[] = "C";
-	static int		num_lines;
-	int                     saverr;
-	int			 fd;
-	char			*lbuf;
-	char			*p;
-	const char 		*plim;
-	char                     filename[PATH_MAX];
-	struct stat		 st;
-	size_t			 namesize;
-	size_t			 bufsize;
-	int                      save_using_locale;
-
-	save_using_locale = *using_locale;
-	*using_locale = 0;
+	int		saverr, fd, i, num_lines;
+	char		*lbuf, *p;
+	const char	*plim;
+	char		filename[PATH_MAX];
+	struct stat	st;
+	size_t		namesize, bufsize;
 
 	/* 'name' must be already checked. */
+	if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
+		*using_locale = 0;
+		return (_LDP_CACHE);
+	}
 
-	if (!strcmp(name, "C") || !strcmp(name, "POSIX"))
-		return 0;
-
 	/*
 	 * If the locale name is the same as our cache, use the cache.
 	 */
-	lbuf = locale_buf;
-	if (lbuf != NULL && strcmp(name, lbuf) == 0) {
-		set_from_buf(lbuf, num_lines, dst_localebuf);
+	if (locale_buf != NULL && strcmp(name, locale_buf) == 0) {
 		*using_locale = 1;
-		return 0;
+		return (_LDP_CACHE);
 	}
 
 	/*
@@ -90,16 +79,14 @@
 	namesize = strlen(name) + 1;
 
 	/* 'PathLocale' must be already set & checked. */
-
 	/* Range checking not needed, 'name' size is limited */
 	strcpy(filename, _PathLocale);
 	strcat(filename, "/");
 	strcat(filename, name);
 	strcat(filename, "/");
 	strcat(filename, category_filename);
-	fd = _open(filename, O_RDONLY);
-	if (fd < 0)
-		goto no_locale;
+	if ((fd = _open(filename, O_RDONLY)) < 0)
+		return (_LDP_ERROR);
 	if (_fstat(fd, &st) != 0)
 		goto bad_locale;
 	if (st.st_size <= 0) {
@@ -107,18 +94,15 @@
 		goto bad_locale;
 	}
 	bufsize = namesize + st.st_size;
-	locale_buf = NULL;
-	lbuf = (lbuf == NULL || lbuf == locale_buf_C) ?
-		malloc(bufsize) : reallocf(lbuf, bufsize);
-	if (lbuf == NULL)
+	if ((lbuf = malloc(bufsize)) == NULL) {
+		errno = ENOMEM;
 		goto bad_locale;
-	(void) strcpy(lbuf, name);
+	}
+	(void)strcpy(lbuf, name);
 	p = lbuf + namesize;
 	plim = p + st.st_size;
 	if (_read(fd, p, (size_t) st.st_size) != st.st_size)
 		goto bad_lbuf;
-	if (_close(fd) != 0)
-		goto bad_lbuf;
 	/*
 	 * Parse the locale file into localebuf.
 	 */
@@ -133,48 +117,44 @@
 		num_lines = locale_buf_size_min;
 	else {
 		errno = EFTYPE;
-		goto reset_locale;
+		goto bad_lbuf;
 	}
-	set_from_buf(lbuf, num_lines, dst_localebuf);
+	(void)_close(fd);
 	/*
 	 * Record the successful parse in the cache.
 	 */
+	if (locale_buf != NULL)
+		free(locale_buf);
 	locale_buf = lbuf;
+	for (p = locale_buf, i = 0; i < num_lines; i++)
+		dst_localebuf[i] = (p += strlen(p) + 1);
+	for (i = num_lines; i < locale_buf_size_max; i++)
+		dst_localebuf[i] = NULL;
+	*using_locale = 1;
 
-	*using_locale = 1;
-	return 0;
+	return (_LDP_LOADED);
 
-reset_locale:
-	locale_buf = locale_buf_C;
-	save_using_locale = 0;
 bad_lbuf:
-	saverr = errno; free(lbuf); errno = saverr;
+	saverr = errno;
+	free(lbuf);
+	errno = saverr;
 bad_locale:
-	saverr = errno; (void)_close(fd); errno = saverr;
-no_locale:
-	*using_locale = save_using_locale;
-	return -1;
+	saverr = errno;
+	(void)_close(fd);
+	errno = saverr;
+
+	return (_LDP_ERROR);
 }
 
 static int
-split_lines(char *p, const char *plim) {
-
+split_lines(char *p, const char *plim)
+{
 	int i;
 
 	for (i = 0; p < plim; i++) {
 		p = strchr(p, '\n');
 		*p++ = '\0';
 	}
-	return i;
-}
-
-static void
-set_from_buf(const char *p, int num_lines, const char **dst_localebuf) {
-
-	const char **ap;
-	int i;
-
-	for (ap = dst_localebuf, i = 0; i < num_lines; ++ap, ++i)
-		*ap = p += strlen(p) + 1;
+	return (i);
 }
 

==== //depot/projects/trustedbsd/base/lib/libc/locale/ldpart.h#4 (text+ko) ====

@@ -23,12 +23,16 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libc/locale/ldpart.h,v 1.4 2001/12/20 18:28:52 phantom Exp $
+ * $FreeBSD: src/lib/libc/locale/ldpart.h,v 1.5 2002/08/08 05:51:54 ache Exp $
  */
 
 #ifndef _LDPART_H_
 #define	_LDPART_H_
 
+#define _LDP_LOADED 0
+#define _LDP_ERROR  (-1)
+#define _LDP_CACHE  1
+
 int	__part_load_locale(const char *, int*, char *, const char *,
 		    int, int, const char **);
 

==== //depot/projects/trustedbsd/base/lib/libc/locale/lmessages.c#5 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/lmessages.c,v 1.10 2002/03/22 21:52:18 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/locale/lmessages.c,v 1.12 2002/08/08 05:51:54 ache Exp $");
 
 #include <stddef.h>
 
@@ -50,25 +50,26 @@
 static char	*_messages_locale_buf;
 
 int
-__messages_load_locale(const char *name) {
+__messages_load_locale(const char *name)
+{
+	int ret;
 
-	/*
-	 * Propose that we can have incomplete locale file (w/o "{yes,no}str").
-	 * Initialize them before loading.  In case of complete locale, they'll
-	 * be initialized to loaded value, otherwise they'll not be touched.
-	 */
-	_messages_locale.yesstr = empty;
-	_messages_locale.nostr = empty;
-
-	return __part_load_locale(name, &_messages_using_locale,
-		_messages_locale_buf, "LC_MESSAGES",
-		LCMESSAGES_SIZE_FULL, LCMESSAGES_SIZE_MIN,
-		(const char **)&_messages_locale);
+	ret = __part_load_locale(name, &_messages_using_locale,
+		  _messages_locale_buf, "LC_MESSAGES",
+		  LCMESSAGES_SIZE_FULL, LCMESSAGES_SIZE_MIN,
+		  (const char **)&_messages_locale);
+	if (ret == _LDP_LOADED) {
+		if (_messages_locale.yesstr == NULL)
+			_messages_locale.yesstr = empty;
+		if (_messages_locale.nostr == NULL)
+			_messages_locale.nostr = empty;
+	}
+	return (ret);
 }
 
 struct lc_messages_T *
-__get_current_messages_locale(void) {
-
+__get_current_messages_locale(void)
+{
 	return (_messages_using_locale
 		? &_messages_locale
 		: (struct lc_messages_T *)&_C_messages_locale);

==== //depot/projects/trustedbsd/base/lib/libc/locale/lmonetary.c#5 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/lmonetary.c,v 1.13 2002/03/22 21:52:18 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/locale/lmonetary.c,v 1.15 2002/08/08 05:51:54 ache Exp $");
 
 #include <limits.h>
 #include <stdlib.h>
@@ -63,23 +63,27 @@
 static char	*_monetary_locale_buf;
 
 static char
-cnv(const char *str) {
+cnv(const char *str)
+{
 	int i = strtol(str, NULL, 10);
+
 	if (i == -1)
 		i = CHAR_MAX;
-	return (char)i;
+	return ((char)i);
 }
 
 int
-__monetary_load_locale(const char *name) {
+__monetary_load_locale(const char *name)
+{
+	int ret;
 
-	int ret;
-	__mlocale_changed = 1;
 	ret = __part_load_locale(name, &_monetary_using_locale,
 		_monetary_locale_buf, "LC_MONETARY",
 		LCMONETARY_SIZE, LCMONETARY_SIZE,
 		(const char **)&_monetary_locale);
-	if (ret == 0 && _monetary_using_locale) {
+	if (ret != _LDP_ERROR)
+		__mlocale_changed = 1;
+	if (ret == _LDP_LOADED) {
 		_monetary_locale.mon_grouping =
 		     __fix_locale_grouping_str(_monetary_locale.mon_grouping);
 
@@ -95,12 +99,12 @@
 		M_ASSIGN_CHAR(p_sign_posn);
 		M_ASSIGN_CHAR(n_sign_posn);
 	}
-	return ret;
+	return (ret);
 }
 
 struct lc_monetary_T *
-__get_current_monetary_locale(void) {
-
+__get_current_monetary_locale(void)
+{
 	return (_monetary_using_locale
 		? &_monetary_locale
 		: (struct lc_monetary_T *)&_C_monetary_locale);

==== //depot/projects/trustedbsd/base/lib/libc/locale/lnumeric.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/locale/lnumeric.c,v 1.11 2002/03/22 21:52:18 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/locale/lnumeric.c,v 1.13 2002/08/08 05:51:54 ache Exp $");
 
 #include <limits.h>
 #include "lnumeric.h"
@@ -49,24 +49,25 @@
 static char	*_numeric_locale_buf;
 
 int
-__numeric_load_locale(const char *name) {
-
+__numeric_load_locale(const char *name)
+{
 	int ret;
 
-	__nlocale_changed = 1;
 	ret = __part_load_locale(name, &_numeric_using_locale,
 		_numeric_locale_buf, "LC_NUMERIC",
 		LCNUMERIC_SIZE, LCNUMERIC_SIZE,
 		(const char **)&_numeric_locale);
-	if (ret == 0 && _numeric_using_locale)
+	if (ret != _LDP_ERROR)
+		__nlocale_changed = 1;
+	if (ret == _LDP_LOADED)
 		_numeric_locale.grouping =

>>> TRUNCATED FOR MAIL (1000 lines) <<<
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list