From owner-p4-projects@FreeBSD.ORG Thu Jul 22 17:30:26 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1EA1916A4D0; Thu, 22 Jul 2004 17:30:26 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA1E616A4CE for ; Thu, 22 Jul 2004 17:30:25 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E31CB43D46 for ; Thu, 22 Jul 2004 17:30:25 +0000 (GMT) (envelope-from dfr@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i6MHUPBL008995 for ; Thu, 22 Jul 2004 17:30:25 GMT (envelope-from dfr@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i6MHUPC8008970 for perforce@freebsd.org; Thu, 22 Jul 2004 17:30:25 GMT (envelope-from dfr@freebsd.org) Date: Thu, 22 Jul 2004 17:30:25 GMT Message-Id: <200407221730.i6MHUPC8008970@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to dfr@freebsd.org using -f From: Doug Rabson To: Perforce Change Reviews Subject: PERFORCE change 57935 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2004 17:30:27 -0000 http://perforce.freebsd.org/chv.cgi?CH=57935 Change 57935 by dfr@dfr_home on 2004/07/22 17:29:41 IFC Affected files ... .. //depot/projects/kse/bin/ps/print.c#19 integrate .. //depot/projects/kse/include/wchar.h#13 integrate .. //depot/projects/kse/lib/libc/locale/Makefile.inc#11 integrate .. //depot/projects/kse/lib/libc/locale/mblocal.h#2 integrate .. //depot/projects/kse/lib/libc/locale/mbsnrtowcs.c#1 branch .. //depot/projects/kse/lib/libc/locale/mbsrtowcs.3#5 integrate .. //depot/projects/kse/lib/libc/locale/mbsrtowcs.c#5 integrate .. //depot/projects/kse/lib/libc/locale/mbstowcs.c#6 integrate .. //depot/projects/kse/lib/libc/locale/none.c#5 integrate .. //depot/projects/kse/lib/libc/locale/setrunelocale.c#7 integrate .. //depot/projects/kse/lib/libc/locale/table.c#5 integrate .. //depot/projects/kse/lib/libc/locale/wcsnrtombs.c#1 branch .. //depot/projects/kse/lib/libc/locale/wcsrtombs.3#5 integrate .. //depot/projects/kse/lib/libc/locale/wcsrtombs.c#5 integrate .. //depot/projects/kse/lib/libc/locale/wcstombs.c#6 integrate .. //depot/projects/kse/lib/libc/net/gethostbydns.c#5 integrate .. //depot/projects/kse/lib/libc/net/name6.c#8 integrate .. //depot/projects/kse/lib/libc/powerpc/_fpmath.h#3 integrate .. //depot/projects/kse/lib/libc/powerpc/gen/Makefile.inc#4 integrate .. //depot/projects/kse/lib/libc/powerpc/gen/makecontext.c#2 integrate .. //depot/projects/kse/lib/libc/powerpc/gen/signalcontext.c#1 branch .. //depot/projects/kse/lib/libc/powerpc/stdlib/gdtoa.mk#2 integrate .. //depot/projects/kse/lib/libc/regex/grot/Makefile#2 integrate .. //depot/projects/kse/lib/libc/stdio/fgetwc.c#7 integrate .. //depot/projects/kse/lib/libc/stdio/fgetws.c#4 integrate .. //depot/projects/kse/lib/libc/stdio/fputwc.c#6 integrate .. //depot/projects/kse/lib/libc/stdio/fputws.c#4 integrate .. //depot/projects/kse/lib/libc/stdio/ungetwc.c#6 integrate .. //depot/projects/kse/lib/libc/sys/statfs.2#4 integrate .. //depot/projects/kse/lib/libpthread/arch/powerpc/Makefile.inc#1 branch .. //depot/projects/kse/lib/libpthread/arch/powerpc/include/atomic_ops.h#1 branch .. //depot/projects/kse/lib/libpthread/arch/powerpc/include/pthread_md.h#1 branch .. //depot/projects/kse/lib/libpthread/arch/powerpc/powerpc/assym.c#1 branch .. //depot/projects/kse/lib/libpthread/arch/powerpc/powerpc/assym.s#1 branch .. //depot/projects/kse/lib/libpthread/arch/powerpc/powerpc/context.S#1 branch .. //depot/projects/kse/lib/libpthread/arch/powerpc/powerpc/enter_uts.S#1 branch .. //depot/projects/kse/lib/libpthread/arch/powerpc/powerpc/pthread_md.c#1 branch .. //depot/projects/kse/sys/alpha/alpha/db_trace.c#9 integrate .. //depot/projects/kse/sys/alpha/alpha/interrupt.c#19 integrate .. //depot/projects/kse/sys/alpha/alpha/pmap.c#40 integrate .. //depot/projects/kse/sys/alpha/include/pmap.h#17 integrate .. //depot/projects/kse/sys/amd64/amd64/db_trace.c#3 integrate .. //depot/projects/kse/sys/amd64/amd64/intr_machdep.c#4 integrate .. //depot/projects/kse/sys/amd64/amd64/pmap.c#6 integrate .. //depot/projects/kse/sys/amd64/include/pmap.h#6 integrate .. //depot/projects/kse/sys/arm/arm/busdma_machdep.c#2 integrate .. //depot/projects/kse/sys/arm/arm/cpufunc.c#2 integrate .. //depot/projects/kse/sys/arm/arm/db_trace.c#3 integrate .. //depot/projects/kse/sys/arm/arm/machdep.c#3 integrate .. //depot/projects/kse/sys/arm/arm/pmap.c#3 integrate .. //depot/projects/kse/sys/arm/arm/support.S#2 integrate .. //depot/projects/kse/sys/arm/include/cpufunc.h#3 integrate .. //depot/projects/kse/sys/arm/include/pcb.h#3 integrate .. //depot/projects/kse/sys/arm/include/pmap.h#3 integrate .. //depot/projects/kse/sys/arm/include/profile.h#2 integrate .. //depot/projects/kse/sys/boot/efi/libefi/arch/ia64/ldscript.ia64#6 integrate .. //depot/projects/kse/sys/boot/efi/libefi/arch/ia64/start.S#6 integrate .. //depot/projects/kse/sys/boot/efi/loader/Makefile#9 integrate .. //depot/projects/kse/sys/compat/ndis/subr_ntoskrnl.c#4 integrate .. //depot/projects/kse/sys/conf/NOTES#24 integrate .. //depot/projects/kse/sys/conf/files.i386#35 integrate .. //depot/projects/kse/sys/conf/options#33 integrate .. //depot/projects/kse/sys/ddb/db_command.c#9 integrate .. //depot/projects/kse/sys/ddb/ddb.h#7 integrate .. //depot/projects/kse/sys/dev/acpica/acpi_timer.c#11 integrate .. //depot/projects/kse/sys/dev/acpica/acpi_video.c#4 integrate .. //depot/projects/kse/sys/dev/cp/if_cp.c#3 integrate .. //depot/projects/kse/sys/dev/ctau/if_ct.c#4 integrate .. //depot/projects/kse/sys/dev/cx/if_cx.c#5 integrate .. //depot/projects/kse/sys/dev/ed/if_ed_pccard.c#9 integrate .. //depot/projects/kse/sys/dev/ep/if_ep_eisa.c#4 integrate .. //depot/projects/kse/sys/dev/ep/if_ep_isa.c#3 integrate .. //depot/projects/kse/sys/dev/ep/if_ep_mca.c#3 integrate .. //depot/projects/kse/sys/dev/firewire/fwohci.c#5 integrate .. //depot/projects/kse/sys/dev/firewire/fwohci_pci.c#6 integrate .. //depot/projects/kse/sys/dev/firewire/if_fwe.c#4 integrate .. //depot/projects/kse/sys/dev/firewire/if_fwip.c#2 integrate .. //depot/projects/kse/sys/dev/firewire/sbp.c#6 integrate .. //depot/projects/kse/sys/dev/pccbb/pccbb.c#26 integrate .. //depot/projects/kse/sys/dev/usb/ehci.c#4 integrate .. //depot/projects/kse/sys/dev/usb/ehci_pci.c#4 integrate .. //depot/projects/kse/sys/dev/usb/uhci.c#22 integrate .. //depot/projects/kse/sys/dev/usb/usbdi.c#12 integrate .. //depot/projects/kse/sys/fs/devfs/devfs_vnops.c#20 integrate .. //depot/projects/kse/sys/i386/acpica/acpi_panasonic.c#1 branch .. //depot/projects/kse/sys/i386/conf/NOTES#45 integrate .. //depot/projects/kse/sys/i386/i386/busdma_machdep.c#8 integrate .. //depot/projects/kse/sys/i386/i386/db_trace.c#12 integrate .. //depot/projects/kse/sys/i386/i386/intr_machdep.c#4 integrate .. //depot/projects/kse/sys/i386/i386/pmap.c#50 integrate .. //depot/projects/kse/sys/i386/i386/vm_machdep.c#71 integrate .. //depot/projects/kse/sys/ia64/ia64/db_trace.c#10 integrate .. //depot/projects/kse/sys/ia64/ia64/pmap.c#38 integrate .. //depot/projects/kse/sys/kern/kern_mutex.c#38 integrate .. //depot/projects/kse/sys/kern/kern_prot.c#37 integrate .. //depot/projects/kse/sys/kern/kern_shutdown.c#38 integrate .. //depot/projects/kse/sys/kern/kern_switch.c#71 integrate .. //depot/projects/kse/sys/kern/subr_kdb.c#2 integrate .. //depot/projects/kse/sys/kern/sys_pipe.c#18 integrate .. //depot/projects/kse/sys/kern/uipc_mbuf.c#15 integrate .. //depot/projects/kse/sys/kern/uipc_mbuf2.c#8 integrate .. //depot/projects/kse/sys/kern/vfs_subr.c#50 integrate .. //depot/projects/kse/sys/modules/acpi/Makefile#13 integrate .. //depot/projects/kse/sys/modules/acpi/acpi_panasonic/Makefile#1 branch .. //depot/projects/kse/sys/net/if_clone.c#2 integrate .. //depot/projects/kse/sys/netatalk/at_control.c#7 integrate .. //depot/projects/kse/sys/netatm/uni/unisig_subr.c#5 integrate .. //depot/projects/kse/sys/netgraph/atm/ng_atm.c#3 integrate .. //depot/projects/kse/sys/netgraph/netgraph.h#7 integrate .. //depot/projects/kse/sys/netgraph/ng_base.c#13 integrate .. //depot/projects/kse/sys/netgraph/ng_bridge.c#8 integrate .. //depot/projects/kse/sys/netgraph/ng_device.c#5 integrate .. //depot/projects/kse/sys/netgraph/ng_ether.c#12 integrate .. //depot/projects/kse/sys/netgraph/ng_gif.c#6 integrate .. //depot/projects/kse/sys/netgraph/ng_sample.c#5 integrate .. //depot/projects/kse/sys/netgraph/ng_source.c#4 integrate .. //depot/projects/kse/sys/netinet/ip_fw2.c#11 integrate .. //depot/projects/kse/sys/netinet/raw_ip.c#22 integrate .. //depot/projects/kse/sys/netinet/tcp_output.c#18 integrate .. //depot/projects/kse/sys/netinet/tcp_subr.c#26 integrate .. //depot/projects/kse/sys/pc98/i386/machdep.c#39 integrate .. //depot/projects/kse/sys/powerpc/include/float.h#6 integrate .. //depot/projects/kse/sys/powerpc/include/frame.h#7 integrate .. //depot/projects/kse/sys/powerpc/powermac/pswitch.c#2 integrate .. //depot/projects/kse/sys/powerpc/powerpc/db_trace.c#5 integrate .. //depot/projects/kse/sys/powerpc/powerpc/elf_machdep.c#8 integrate .. //depot/projects/kse/sys/powerpc/powerpc/genassym.c#20 integrate .. //depot/projects/kse/sys/powerpc/powerpc/machdep.c#28 integrate .. //depot/projects/kse/sys/powerpc/powerpc/swtch.S#3 integrate .. //depot/projects/kse/sys/powerpc/powerpc/vm_machdep.c#20 integrate .. //depot/projects/kse/sys/sparc64/sparc64/db_trace.c#14 integrate .. //depot/projects/kse/sys/sys/cdefs.h#22 integrate .. //depot/projects/kse/sys/sys/kdb.h#2 integrate .. //depot/projects/kse/sys/sys/mbuf.h#20 integrate .. //depot/projects/kse/sys/sys/pipe.h#5 integrate .. //depot/projects/kse/sys/vm/uma_core.c#19 integrate .. //depot/projects/kse/sys/vm/vm_contig.c#14 integrate .. //depot/projects/kse/sys/vm/vm_map.c#31 integrate .. //depot/projects/kse/sys/vm/vm_page.c#22 integrate .. //depot/projects/kse/tools/regression/lib/libc/locale/Makefile#2 integrate .. //depot/projects/kse/tools/regression/lib/libc/locale/test-mbsnrtowcs.c#1 branch .. //depot/projects/kse/tools/regression/lib/libc/locale/test-towctrans.c#2 integrate .. //depot/projects/kse/tools/regression/lib/libc/locale/test-wcsnrtombs.c#1 branch .. //depot/projects/kse/tools/regression/lib/libc/regex/Makefile#1 branch .. //depot/projects/kse/tools/regression/pipe/bigpipetest.c#2 integrate .. //depot/projects/kse/tools/regression/pipe/pipe-fstatbug.c#1 branch .. //depot/projects/kse/tools/regression/pipe/pipe-reverse.c#1 branch .. //depot/projects/kse/tools/regression/pipe/pipe-wraparound.c#1 branch Differences ... ==== //depot/projects/kse/bin/ps/print.c#19 (text+ko) ==== @@ -34,7 +34,7 @@ #endif #include -__FBSDID("$FreeBSD: src/bin/ps/print.c,v 1.92 2004/06/27 23:59:38 gad Exp $"); +__FBSDID("$FreeBSD: src/bin/ps/print.c,v 1.93 2004/07/20 05:52:00 tjr Exp $"); #include #include @@ -785,7 +785,7 @@ v = ve->var; string = NULL; if (mac_prepare_process_label(&proclabel) == -1) { - perror("mac_prepare_process_label"); + warn("mac_prepare_process_label"); goto out; } error = mac_get_pid(k->ki_p->ki_pid, proclabel); @@ -811,7 +811,7 @@ int error, size = 0; if (mac_prepare_process_label(&proclabel) == -1) { - perror("mac_prepare_process_label"); + warn("mac_prepare_process_label"); return (0); } error = mac_get_pid(k->ki_p->ki_pid, proclabel); ==== //depot/projects/kse/include/wchar.h#13 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/include/wchar.h,v 1.42 2004/07/16 06:06:09 tjr Exp $ + * $FreeBSD: src/include/wchar.h,v 1.43 2004/07/21 10:54:57 tjr Exp $ */ /*- @@ -209,6 +209,10 @@ #if __BSD_VISIBLE wchar_t *fgetwln(struct __sFILE * __restrict, size_t * __restrict); +size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, + size_t, mbstate_t * __restrict); +size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t, + size_t, mbstate_t * __restrict); size_t wcslcat(wchar_t *, const wchar_t *, size_t); size_t wcslcpy(wchar_t *, const wchar_t *, size_t); #endif ==== //depot/projects/kse/lib/libc/locale/Makefile.inc#11 (text+ko) ==== @@ -1,5 +1,5 @@ # from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 -# $FreeBSD: src/lib/libc/locale/Makefile.inc,v 1.56 2004/07/08 06:43:37 tjr Exp $ +# $FreeBSD: src/lib/libc/locale/Makefile.inc,v 1.57 2004/07/21 10:54:57 tjr Exp $ # locale sources .PATH: ${.CURDIR}/${MACHINE_ARCH}/locale ${.CURDIR}/locale @@ -8,11 +8,13 @@ gb18030.c gb2312.c gbk.c isctype.c iswctype.c \ ldpart.c lmessages.c lmonetary.c lnumeric.c localeconv.c mblen.c \ mbrlen.c \ - mbrtowc.c mbrune.c mbsinit.c mbsrtowcs.c mbtowc.c mbstowcs.c \ + mbrtowc.c mbrune.c mbsinit.c mbsnrtowcs.c \ + mbsrtowcs.c mbtowc.c mbstowcs.c \ mskanji.c nextwctype.c nl_langinfo.c nomacros.c none.c rune.c \ runetype.c setinvalidrune.c setlocale.c setrunelocale.c srune.c \ table.c \ - tolower.c toupper.c utf2.c utf8.c wcrtomb.c wcsrtombs.c wcsftime.c \ + tolower.c toupper.c utf2.c utf8.c wcrtomb.c wcsnrtombs.c \ + wcsrtombs.c wcsftime.c \ wcstof.c wcstod.c \ wcstoimax.c wcstol.c wcstold.c wcstoll.c \ wcstombs.c \ @@ -47,9 +49,11 @@ iswalnum.3 iswupper.3 iswalnum.3 iswxdigit.3 MLINKS+=isxdigit.3 ishexnumber.3 MLINKS+=mbrune.3 mbmb.3 mbrune.3 mbrrune.3 +MLINKS+=mbsrtowcs.3 mbsnrtowcs.3 MLINKS+=rune.3 fgetrune.3 rune.3 fputrune.3 rune.3 fungetrune.3 \ rune.3 setinvalidrune.3 rune.3 setrunelocale.3 rune.3 sgetrune.3 \ rune.3 sputrune.3 +MLINKS+=wcsrtombs.3 wcsnrtombs.3 MLINKS+=wcstod.3 wcstof.3 wcstod.3 wcstold.3 MLINKS+=wcstol.3 wcstoul.3 wcstol.3 wcstoll.3 wcstol.3 wcstoull.3 \ wcstol.3 wcstoimax.3 wcstol.3 wcstoumax.3 ==== //depot/projects/kse/lib/libc/locale/mblocal.h#2 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libc/locale/mblocal.h,v 1.2 2004/05/13 11:20:27 tjr Exp $ + * $FreeBSD: src/lib/libc/locale/mblocal.h,v 1.3 2004/07/21 10:54:57 tjr Exp $ */ #ifndef _MBLOCAL_H_ @@ -37,11 +37,11 @@ extern size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict); extern int (*__mbsinit)(const mbstate_t *); -extern size_t (*__mbsrtowcs)(wchar_t * __restrict, const char ** __restrict, - size_t, mbstate_t * __restrict); +extern size_t (*__mbsnrtowcs)(wchar_t * __restrict, const char ** __restrict, + size_t, size_t, mbstate_t * __restrict); extern size_t (*__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict); -extern size_t (*__wcsrtombs)(char * __restrict, const wchar_t ** __restrict, - size_t, mbstate_t * __restrict); +extern size_t (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict, + size_t, size_t, mbstate_t * __restrict); /* * Conversion functions for "NONE"/C/POSIX encoding. @@ -49,17 +49,17 @@ extern size_t _none_mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict); extern int _none_mbsinit(const mbstate_t *); -extern size_t _none_mbsrtowcs(wchar_t * __restrict, const char ** __restrict, - size_t, mbstate_t * __restrict); +extern size_t _none_mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, + size_t, size_t, mbstate_t * __restrict); extern size_t _none_wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict); -extern size_t _none_wcsrtombs(char * __restrict, const wchar_t ** __restrict, - size_t, mbstate_t * __restrict); +extern size_t _none_wcsnrtombs(char * __restrict, const wchar_t ** __restrict, + size_t, size_t, mbstate_t * __restrict); -extern size_t __mbsrtowcs_std(wchar_t * __restrict, const char ** __restrict, - size_t, mbstate_t * __restrict); -extern size_t __wcsrtombs_std(char * __restrict, const wchar_t ** __restrict, - size_t, mbstate_t * __restrict); +extern size_t __mbsnrtowcs_std(wchar_t * __restrict, const char ** __restrict, + size_t, size_t, mbstate_t * __restrict); +extern size_t __wcsnrtombs_std(char * __restrict, const wchar_t ** __restrict, + size_t, size_t, mbstate_t * __restrict); /* * Rune emulation functions. ==== //depot/projects/kse/lib/libc/locale/mbsrtowcs.3#5 (text+ko) ==== @@ -22,12 +22,13 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc/locale/mbsrtowcs.3,v 1.4 2004/04/08 09:59:02 tjr Exp $ -.Dd April 8, 2004 +.\" $FreeBSD: src/lib/libc/locale/mbsrtowcs.3,v 1.5 2004/07/21 10:54:57 tjr Exp $ +.Dd July 21, 2004 .Dt MBSRTOWCS 3 .Os .Sh NAME -.Nm mbsrtowcs +.Nm mbsrtowcs , +.Nm mbsnrtowcs .Nd "convert a character string to a wide-character string (restartable)" .Sh LIBRARY .Lb libc @@ -38,6 +39,11 @@ .Fa "wchar_t * restrict dst" "const char ** restrict src" "size_t len" .Fa "mbstate_t * restrict ps" .Fc +.Ft size_t +.Fo mbsnrtowcs +.Fa "wchar_t * restrict dst" "const char ** restrict src" "size_t nms" +.Fa "size_t len" "mbstate_t * restrict ps" +.Fc .Sh DESCRIPTION The .Fn mbsrtowcs @@ -82,10 +88,21 @@ .Vt mbstate_t object, which is initialized to the initial conversion state at program startup. +.Pp +The +.Fn mbsnrtowcs +function behaves identically to +.Fn mbsrtowcs , +except that conversion stops after reading at most +.Fa nms +bytes from the buffer pointed to by +.Fa src . .Sh RETURN VALUES The .Fn mbsrtowcs -function returns the number of wide characters stored in +and +.Fn mbsnrtowcs +functions return the number of wide characters stored in the array pointed to by .Fa dst if successful, otherwise it returns @@ -93,7 +110,9 @@ .Sh ERRORS The .Fn mbsrtowcs -function will fail if: +and +.Fn mbsnrtowcs +functions will fail if: .Bl -tag -width Er .It Bq Er EILSEQ An invalid multibyte character sequence was encountered. @@ -110,3 +129,7 @@ .Fn mbsrtowcs function conforms to .St -isoC-99 . +.Pp +The +.Fn mbsnrtowcs +function is an extension to the standard. ==== //depot/projects/kse/lib/libc/locale/mbsrtowcs.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/mbsrtowcs.c,v 1.5 2004/05/13 11:20:27 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/mbsrtowcs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $"); #include #include @@ -41,46 +41,5 @@ if (ps == NULL) ps = &mbs; - return (__mbsrtowcs(dst, src, len, ps)); -} - -size_t -__mbsrtowcs_std(wchar_t * __restrict dst, const char ** __restrict src, - size_t len, mbstate_t * __restrict ps) -{ - const char *s; - size_t nchr; - wchar_t wc; - int nb; - - s = *src; - nchr = 0; - - if (dst == NULL) { - for (;;) { - if ((nb = (int)__mbrtowc(&wc, s, MB_CUR_MAX, ps)) < 0) - /* Invalid sequence - mbrtowc() sets errno. */ - return ((size_t)-1); - else if (nb == 0) - return (nchr); - s += nb; - nchr++; - } - /*NOTREACHED*/ - } - - while (len-- > 0) { - if ((nb = (int)__mbrtowc(dst, s, MB_CUR_MAX, ps)) < 0) { - *src = s; - return ((size_t)-1); - } else if (nb == 0) { - *src = NULL; - return (nchr); - } - s += nb; - nchr++; - dst++; - } - *src = s; - return (nchr); + return (__mbsnrtowcs(dst, src, SIZE_T_MAX, len, ps)); } ==== //depot/projects/kse/lib/libc/locale/mbstowcs.c#6 (text+ko) ==== @@ -25,8 +25,9 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.10 2004/05/13 11:20:27 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.11 2004/07/21 10:54:57 tjr Exp $"); +#include #include #include #include "mblocal.h" @@ -38,5 +39,5 @@ mbstate_t mbs; mbs = initial; - return (__mbsrtowcs(pwcs, &s, n, &mbs)); + return (__mbsnrtowcs(pwcs, &s, SIZE_T_MAX, n, &mbs)); } ==== //depot/projects/kse/lib/libc/locale/none.c#5 (text+ko) ==== @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)none.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.11 2004/05/25 10:45:24 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.12 2004/07/21 10:54:57 tjr Exp $"); #include #include @@ -55,11 +55,12 @@ size_t _none_mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict); int _none_mbsinit(const mbstate_t *); -size_t _none_mbsrtowcs(wchar_t * __restrict, const char ** __restrict, - size_t, mbstate_t * __restrict); +size_t _none_mbsnrtowcs(wchar_t * __restrict dst, + const char ** __restrict src, size_t nms, size_t len, + mbstate_t * __restrict ps __unused); size_t _none_wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict); -size_t _none_wcsrtombs(char * __restrict, const wchar_t ** __restrict, - size_t, mbstate_t * __restrict); +size_t _none_wcsnrtombs(char * __restrict, const wchar_t ** __restrict, + size_t, size_t, mbstate_t * __restrict); int _none_init(_RuneLocale *rl) @@ -67,9 +68,9 @@ __mbrtowc = _none_mbrtowc; __mbsinit = _none_mbsinit; - __mbsrtowcs = _none_mbsrtowcs; + __mbsnrtowcs = _none_mbsnrtowcs; __wcrtomb = _none_wcrtomb; - __wcsrtombs = _none_wcsrtombs; + __wcsnrtombs = _none_wcsnrtombs; _CurrentRuneLocale = rl; __mb_cur_max = 1; return(0); @@ -119,18 +120,20 @@ } size_t -_none_mbsrtowcs(wchar_t * __restrict dst, const char ** __restrict src, - size_t len, mbstate_t * __restrict ps __unused) +_none_mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src, + size_t nms, size_t len, mbstate_t * __restrict ps __unused) { const char *s; size_t nchr; - if (dst == NULL) - return (strlen(*src)); + if (dst == NULL) { + s = memchr(*src, '\0', nms); + return (s != NULL ? s - *src : nms); + } s = *src; nchr = 0; - while (len-- > 0) { + while (len-- > 0 && nms-- > 0) { if ((*dst++ = (unsigned char)*s++) == L'\0') { *src = NULL; return (nchr); @@ -142,14 +145,14 @@ } size_t -_none_wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, - size_t len, mbstate_t * __restrict ps __unused) +_none_wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, + size_t nwc, size_t len, mbstate_t * __restrict ps __unused) { const wchar_t *s; size_t nchr; if (dst == NULL) { - for (s = *src; *s != L'\0'; s++) { + for (s = *src; nwc > 0 && *s != L'\0'; s++, nwc--) { if (*s < 0 || *s > UCHAR_MAX) { errno = EILSEQ; return ((size_t)-1); @@ -160,7 +163,7 @@ s = *src; nchr = 0; - while (len-- > 0) { + while (len-- > 0 && nwc-- > 0) { if (*s < 0 || *s > UCHAR_MAX) { errno = EILSEQ; return ((size_t)-1); ==== //depot/projects/kse/lib/libc/locale/setrunelocale.c#7 (text+ko) ==== @@ -38,7 +38,7 @@ #define OBSOLETE_IN_6 #include -__FBSDID("$FreeBSD: src/lib/libc/locale/setrunelocale.c,v 1.39 2004/06/23 07:01:43 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/setrunelocale.c,v 1.40 2004/07/21 10:54:57 tjr Exp $"); #include #include @@ -100,10 +100,11 @@ static size_t (*Cached__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict); static int (*Cached__mbsinit)(const mbstate_t *); - static size_t (*Cached__mbsrtowcs)(wchar_t * __restrict, - const char ** __restrict, size_t, mbstate_t * __restrict); - static size_t (*Cached__wcsrtombs)(char * __restrict, - const wchar_t ** __restrict, size_t, mbstate_t * __restrict); + static size_t (*Cached__mbsnrtowcs)(wchar_t * __restrict, + const char ** __restrict, size_t, size_t, mbstate_t * __restrict); + static size_t (*Cached__wcsnrtombs)(char * __restrict, + const wchar_t ** __restrict, size_t, size_t, + mbstate_t * __restrict); /* * The "C" and "POSIX" locale are always here. @@ -113,9 +114,9 @@ __mb_cur_max = 1; __mbrtowc = _none_mbrtowc; __mbsinit = _none_mbsinit; - __mbsrtowcs = _none_mbsrtowcs; + __mbsnrtowcs = _none_mbsnrtowcs; __wcrtomb = _none_wcrtomb; - __wcsrtombs = _none_wcsrtombs; + __wcsnrtombs = _none_wcsnrtombs; return (0); } @@ -128,9 +129,9 @@ __mb_cur_max = Cached__mb_cur_max; __mbrtowc = Cached__mbrtowc; __mbsinit = Cached__mbsinit; - __mbsrtowcs = Cached__mbsrtowcs; + __mbsnrtowcs = Cached__mbsnrtowcs; __wcrtomb = Cached__wcrtomb; - __wcsrtombs = Cached__wcsrtombs; + __wcsnrtombs = Cached__wcsnrtombs; return (0); } @@ -156,9 +157,9 @@ __mbrtowc = NULL; __mbsinit = NULL; - __mbsrtowcs = __mbsrtowcs_std; + __mbsnrtowcs = __mbsnrtowcs_std; __wcrtomb = NULL; - __wcsrtombs = __wcsrtombs_std; + __wcsnrtombs = __wcsnrtombs_std; rl->__sputrune = __emulated_sputrune; rl->__sgetrune = __emulated_sgetrune; if (strcmp(rl->__encoding, "NONE") == 0) @@ -192,9 +193,9 @@ Cached__mb_cur_max = __mb_cur_max; Cached__mbrtowc = __mbrtowc; Cached__mbsinit = __mbsinit; - Cached__mbsrtowcs = __mbsrtowcs; + Cached__mbsnrtowcs = __mbsnrtowcs; Cached__wcrtomb = __wcrtomb; - Cached__wcsrtombs = __wcsrtombs; + Cached__wcsnrtombs = __wcsnrtombs; (void)strcpy(ctype_encoding, encoding); } else free(rl); ==== //depot/projects/kse/lib/libc/locale/table.c#5 (text+ko) ==== @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/27/93"; #endif /* LIBC_SCCS and not lint */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/table.c,v 1.23 2004/05/13 11:20:27 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/table.c,v 1.24 2004/07/21 10:54:57 tjr Exp $"); #include #include @@ -255,9 +255,9 @@ size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict) = _none_mbrtowc; int (*__mbsinit)(const mbstate_t *) = _none_mbsinit; -size_t (*__mbsrtowcs)(wchar_t * __restrict, const char ** __restrict, - size_t, mbstate_t * __restrict) = _none_mbsrtowcs; +size_t (*__mbsnrtowcs)(wchar_t * __restrict, const char ** __restrict, + size_t, size_t, mbstate_t * __restrict) = _none_mbsnrtowcs; size_t (*__wcrtomb)(char * __restrict, wchar_t, mbstate_t * __restrict) = _none_wcrtomb; -size_t (*__wcsrtombs)(char * __restrict, const wchar_t ** __restrict, - size_t, mbstate_t * __restrict) = _none_wcsrtombs; +size_t (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict, + size_t, size_t, mbstate_t * __restrict) = _none_wcsnrtombs; ==== //depot/projects/kse/lib/libc/locale/wcsrtombs.3#5 (text+ko) ==== @@ -22,13 +22,14 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libc/locale/wcsrtombs.3,v 1.4 2004/04/08 09:59:02 tjr Exp $ +.\" $FreeBSD: src/lib/libc/locale/wcsrtombs.3,v 1.5 2004/07/21 10:54:57 tjr Exp $ .\" -.Dd April 8, 2004 +.Dd July 21, 2004 .Dt WCSRTOMBS 3 .Os .Sh NAME -.Nm wcsrtombs +.Nm wcsrtombs , +.Nm wcsnrtombs .Nd "convert a wide-character string to a character string (restartable)" .Sh LIBRARY .Lb libc @@ -39,6 +40,11 @@ .Fa "char * restrict dst" "const wchar_t ** restrict src" .Fa "size_t len" "mbstate_t * restrict ps" .Fc +.Ft size_t +.Fo wcsnrtombs +.Fa "char * restrict dst" "const wchar_t ** restrict src" "size_t nwc" +.Fa "size_t len" "mbstate_t * restrict ps" +.Fc .Sh DESCRIPTION The .Fn wcsrtombs @@ -82,10 +88,21 @@ .Vt mbstate_t object, which is initialized to the initial conversion state at program startup. +.Pp +The +.Fn wcsnrtombs +function behaves identically to +.Fn wcsrtombs , +except that conversion stops after reading at most +.Fa nwc +characters from the buffer pointed to by +.Fa src . .Sh RETURN VALUES The .Fn wcsrtombs -function returns the number of bytes stored in +and +.Fn wcsnrtombs +functions return the number of bytes stored in the array pointed to by .Fa dst (not including any terminating null), if successful, otherwise it returns @@ -93,7 +110,9 @@ .Sh ERRORS The .Fn wcsrtombs -function will fail if: +and +.Fn wcsnrtombs +functions will fail if: .Bl -tag -width Er .It Bq Er EILSEQ An invalid wide character was encountered. @@ -109,3 +128,7 @@ .Fn wcsrtombs function conforms to .St -isoC-99 . +.Pp +The +.Fn wcsnrtombs +function is an extension to the standard. ==== //depot/projects/kse/lib/libc/locale/wcsrtombs.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.5 2004/05/13 11:20:27 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $"); #include #include @@ -41,71 +41,5 @@ if (ps == NULL) ps = &mbs; - return (__wcsrtombs(dst, src, len, ps)); -} - -size_t -__wcsrtombs_std(char * __restrict dst, const wchar_t ** __restrict src, - size_t len, mbstate_t * __restrict ps) -{ - mbstate_t mbsbak; - char buf[MB_LEN_MAX]; - const wchar_t *s; - size_t nbytes; - int nb; - - s = *src; - nbytes = 0; - - if (dst == NULL) { - for (;;) { - if ((nb = (int)__wcrtomb(buf, *s, ps)) < 0) - /* Invalid character - wcrtomb() sets errno. */ - return ((size_t)-1); - else if (*s == L'\0') - return (nbytes + nb - 1); - s++; - nbytes += nb; - } - /*NOTREACHED*/ - } - - while (len > 0) { - if (len > (size_t)MB_CUR_MAX) { - /* Enough space to translate in-place. */ - if ((nb = (int)__wcrtomb(dst, *s, ps)) < 0) { - *src = s; - return ((size_t)-1); - } - } else { - /* - * May not be enough space; use temp. buffer. - * - * We need to save a copy of the conversion state - * here so we can restore it if the multibyte - * character is too long for the buffer. - */ - mbsbak = *ps; - if ((nb = (int)__wcrtomb(buf, *s, ps)) < 0) { - *src = s; - return ((size_t)-1); - } - if (nb > (int)len) { - /* MB sequence for character won't fit. */ - *ps = mbsbak; - break; - } - memcpy(dst, buf, nb); - } - if (*s == L'\0') { - *src = NULL; - return (nbytes + nb - 1); - } - s++; - dst += nb; - len -= nb; - nbytes += nb; - } - *src = s; - return (nbytes); + return (__wcsnrtombs(dst, src, SIZE_T_MAX, len, ps)); } ==== //depot/projects/kse/lib/libc/locale/wcstombs.c#6 (text+ko) ==== @@ -25,8 +25,9 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/wcstombs.c,v 1.9 2004/05/13 11:20:27 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/wcstombs.c,v 1.10 2004/07/21 10:54:57 tjr Exp $"); +#include #include #include #include "mblocal.h" @@ -38,5 +39,5 @@ mbstate_t mbs; mbs = initial; - return (__wcsrtombs(s, &pwcs, n, &mbs)); + return (__wcsnrtombs(s, &pwcs, SIZE_T_MAX, n, &mbs)); } ==== //depot/projects/kse/lib/libc/net/gethostbydns.c#5 (text+ko) ==== @@ -58,7 +58,7 @@ static char fromrcsid[] = "From: Id: gethnamaddr.c,v 8.23 1998/04/07 04:59:46 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include -__FBSDID("$FreeBSD: src/lib/libc/net/gethostbydns.c,v 1.45 2004/03/05 08:10:17 markm Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/net/gethostbydns.c,v 1.46 2004/07/21 17:26:40 ume Exp $"); #include #include @@ -683,12 +683,6 @@ return NS_NOTFOUND; } n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf->buf, sizeof buf->buf); - if (n < 0 && af == AF_INET6) { - *qp = '\0'; - strlcat(qbuf, "ip6.int", sizeof(qbuf)); - n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf->buf, - sizeof buf->buf); - } if (n < 0) { free(buf); dprintf("res_query failed (%d)\n", n); ==== //depot/projects/kse/lib/libc/net/name6.c#8 (text+ko) ==== @@ -94,7 +94,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/net/name6.c,v 1.38 2004/06/02 06:49:36 ume Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/net/name6.c,v 1.39 2004/07/21 17:26:40 ume Exp $"); #include "namespace.h" #include @@ -2082,7 +2082,7 @@ querybuf *buf; char qbuf[MAXDNAME+1]; char *hlist[2]; - char *tld6[] = { "ip6.arpa", "ip6.int", NULL }; + char *tld6[] = { "ip6.arpa", NULL }; char *tld4[] = { "in-addr.arpa", NULL }; char **tld; ==== //depot/projects/kse/lib/libc/powerpc/_fpmath.h#3 (text+ko) ==== @@ -23,28 +23,26 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libc/powerpc/_fpmath.h,v 1.4 2004/01/18 07:57:02 das Exp $ + * $FreeBSD: src/lib/libc/powerpc/_fpmath.h,v 1.5 2004/07/19 23:56:06 gallatin Exp $ */ union IEEEl2bits { long double e; struct { unsigned int sign :1; - unsigned int exp :15; - unsigned long long manh :48; - unsigned long long manl :64; + unsigned int exp :11; + unsigned int manh :20; + unsigned int manl :32; } bits; }; #define mask_nbit_l(u) ((void)0) #define LDBL_IMPLICIT_NBIT -#define LDBL_MANH_SIZE 48 -#define LDBL_MANL_SIZE 64 +#define LDBL_MANH_SIZE 20 +#define LDBL_MANL_SIZE 32 #define LDBL_TO_ARRAY32(u, a) do { \ (a)[0] = (uint32_t)(u).bits.manl; \ - (a)[1] = (uint32_t)((u).bits.manl >> 32); \ - (a)[2] = (uint32_t)(u).bits.manh; \ - (a)[3] = (uint32_t)((u).bits.manh >> 32); \ + (a)[1] = (uint32_t)(u).bits.manh; \ } while(0) ==== //depot/projects/kse/lib/libc/powerpc/gen/Makefile.inc#4 (text+ko) ==== @@ -1,8 +1,8 @@ -# $FreeBSD: src/lib/libc/powerpc/gen/Makefile.inc,v 1.5 2004/07/18 21:23:39 das Exp $ +# $FreeBSD: src/lib/libc/powerpc/gen/Makefile.inc,v 1.6 2004/07/19 12:08:03 grehan Exp $ SRCS += _ctx_start.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ fpgetsticky.c fpsetmask.c fpsetround.c fpsetsticky.c \ infinity.c ldexp.c makecontext.c modf.c _setjmp.S \ - setjmp.S sigsetjmp.S syncicache.c + setjmp.S sigsetjmp.S signalcontext.c syncicache.c ==== //depot/projects/kse/lib/libc/powerpc/gen/makecontext.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/powerpc/gen/makecontext.c,v 1.1 2004/03/02 06:22:24 grehan Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/powerpc/gen/makecontext.c,v 1.2 2004/07/19 12:05:07 grehan Exp $"); #include @@ -113,7 +113,7 @@ * Use caller-saved regs 14/15 to hold params that _ctx_start * will use to invoke the user-supplied func */ - mc->mc_lr = (uint32_t) _ctx_start; + mc->mc_srr0 = (uint32_t) _ctx_start; mc->mc_gpr[1] = (uint32_t) sp; /* new stack pointer */ mc->mc_gpr[14] = (uint32_t) start; /* r14 <- start */ mc->mc_gpr[15] = (uint32_t) ucp; /* r15 <- ucp */ ==== //depot/projects/kse/lib/libc/powerpc/stdlib/gdtoa.mk#2 (text+ko) ==== @@ -1,5 +1,4 @@ -# $FreeBSD: src/lib/libc/powerpc/stdlib/gdtoa.mk,v 1.1 2003/03/12 20:29:59 das Exp $ +# $FreeBSD: src/lib/libc/powerpc/stdlib/gdtoa.mk,v 1.2 2004/07/19 23:56:07 gallatin Exp $ -# Long double is quad precision -GDTOASRCS+=strtopQ.c -MDSRCS+=machdep_ldisQ.c +# Long double is 64-bits +MDSRCS+=machdep_ldisd.c ==== //depot/projects/kse/lib/libc/regex/grot/Makefile#2 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/lib/libc/regex/grot/Makefile,v 1.2 2000/07/10 06:10:47 green Exp $ +# $FreeBSD: src/lib/libc/regex/grot/Makefile,v 1.4 2004/07/19 08:48:17 tjr Exp $ # You probably want to take -DREDEBUG out of CFLAGS, and put something like # -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of # internal assertion checking). Take -Dconst= out for an ANSI compiler. @@ -24,7 +24,7 @@ HMISSING = SRCMISSING = split.c OBJMISSING = split.o -H = cclass.h cname.h regex2.h utils.h $(HMISSING) +H = cname.h regex2.h utils.h $(HMISSING) REGSRC = regcomp.c regerror.c regexec.c regfree.c engine.c SRC = $(REGSRC) debug.c main.c $(SRCMISSING) @@ -39,7 +39,7 @@ .SUFFIXES: .ih .h .c.ih: - ./mkh $(MKHFLAGS) -p $< >$@ + sh mkh $(MKHFLAGS) -p $< >$@ default: r @@ -48,14 +48,16 @@ o: $(OBJPRODN) -REGEXHSRC = regex2.h reg*.c +REGEXHSRC = ../regex2.h ../reg*.c h: $(REGEXHSRC) - ./mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.tmp >>> TRUNCATED FOR MAIL (1000 lines) <<<